« first day (2606 days earlier)      last day (2342 days later) » 

4:00 PM
It's class C that has a HashTable with [ "I" => ["int"], "T" => ["int"] ]
 
right, so a hash table lookup every time a type check happens (even with cached pointers)
not saying that's bad, just trying to understand
 
@Ekin So for Christmas you want a plinko machine :P
Oh BTW you're 2-years late @Ekin
 
Even if we had traits + interfaces in 7.3 or 8.0 or whatever we'll eventually want regular classes too. At that point specialization is (I think) totally unacceptable. May as well do it this way now, and based on the work we've done so far I don't think it's that crazy.
 
moooOARnings
 
4:05 PM
@Fabor :) niiice. I bumped into it today when I was trying to remember kazoo in fact
 
Repost! Stealing all my karma! :D
 
:P
 
there's a reason that nobody attempted to implement generic classes ... you're not wrong, classes can't work like traits can, but it doesn't seem like our problem ...
if you want to make it our problem, that's fine ... focusing on the task at hand is also a good way to get it finished ... it might take us many many months to figure all this out, we might even miss the next release ...
tl;dr I'm scared
 
Interfaces could work either way, I suppose.
 
4:08 PM
Morning.
 
At that point specialization is (I think) totally unacceptable, I'm curious why? Not saying I disagree yet, but that's a pretty strong stance. Given that it would shift the cost to compile-time (which is cachable) and that C++ has done pretty well with that model, I'm wondering why it's a non-starter?
 
@LeviMorrison I know i keep insisting on the same but AFAIK that would totally forbid using the same trait with different Ts in the same class, right?
 
@pmmaga Using the same trait twice will cause method redefinition errors. Changing types does not change that.
The feature you want is method calls to be dispatched based on types, if I remember correctly.
 
Wes
i don't know why you are complicating your life with traits, that's the last thing to support imo
 
I know! method name mangling! :D
 
4:10 PM
: unless you redefine the method names
 
@ircmaxell I guess that is true. That's a whole can of worms I wish you didn't open.
Do we permit it right now? Two traits with different method renames?
Based on my experience there is a chance it works and a chance it doesn't :D
 
yes
 
we're going to be picking up worms and cramming them into cans until PHP 12, I can just see it coming ...
 
@LeviMorrison well.... github.com/php/php-src/pull/2616 kinda
 
actually, looks like fun: 3v4l.org/AKio8
 
4:15 PM
I don't think it works. Phew.
 
HHVM works though :-P
 
Apparently as only aliases, doesn't rename.
 
Wes
it is not well known that traits don't rename methods, they just alias them
trait A { function bar(){} }
class B{ use A{bar as qux} }
$b = new B;
$b->bar();
$b->qux();
both works
 
Yes. This means using the same trait twice would cause an issue unless there are no methods at all (and I think we changed how conflicting properties work recently so dunno there)
 
Wes
trait A {
function test(){ $this->bar(); } // because this must continue working
function bar(){}
}
i get a little bit of sick in my mouth every time i think of traits
:B
 
4:19 PM
trait T { }

class C {
   use T;
   use T;
}
 
@Wes Traits are edge cases. They suck if you try to use them in any other way
 
The real question is there some variant on that which is useful?
If you add methods, it fails. Which means for generics/templates that aspect is safe.
But use'ing the same trait twice is apparently not an error of itself.
 
Wes
sorry, too much sick. need antacid
:D
 
So, you can't use the same interface twice with different specifications, because of method clashes, so you are "safe" there
unless variance is introduced
though, there is another case. let me pull a poc
 
4:23 PM
3v4l.org/R6F2Y @LeviMorrison there's the problem case
 
@ircmaxell I think that's fine, actually.
 
@jacktriun why do you do that? </span style="color:#96588a;">
 
B method would take precedence over A there. That isn't a trait related thing, just regular subclassing stuff.
 
@LeviMorrison yes, but it would lead to the same trait being used by the descendent class with two type specializations
imagine this: 3v4l.org/Atg7D
C would have the Foo specialization, and B would have the Bar specialization, but there's no way to disambiguate that unless you store the speclization on the method (or have complicated checking rules)
 
:D We already store stuff for methods
Here's why: imagine you use two different traits and they both use T as the name of the type parameter. On the method you need to know which one it belongs to.
 
4:30 PM
yes, but that's a definition item, isn't it? Not a specialization item?
 
No. Trait methods get copied onto the class and do not maintain an association of which trait they actually came from.
And you can't hijack prototype; I investigated that already :D
It's weird but right now we put a hashtable on the class which maintains a "method name" => concrete type arguments mapping.
We could put it directly on the method but altering the size of zend_function and friends is not fun.
And if we move to the model I'm proposing you don't want to alter methods anyway.
That's not quite the same issue so I put a strike through it.
 
fair enough :)
 
Sometimes I think that the chat in here devolves so much to just fart and dad jokes that we really aren't PHP chat, then these guys show up and restore balance to my universe :)
 
evenings v2 o/
I think you were present when Joe and Levi had a ~6 hours of conversation on generics and traits
 
@FélixGagnon-Grenier yes
 
4:41 PM
"yes" is rarely a suitable response to "why".
 
@FélixGagnon-Grenier yes at output i am able to achieve in product tab with piece of code.Just need css and accordion for the same
 
@Ocramius Have you ever used the same trait twice on the same class?
 
hehehe, if he hasn't, nobody has :-P
 
DateTime::createFromTimestamp() method – #75623
 
:D If he hasn't I'll email internals but I think we can forbid it.
Which puts me back on-track for an actual plan for wide-spread generics.
 
4:48 PM
Challenge (solve without scripting): Find the smallest positive integer which ends in 17, is divisible by 17, and whose digits sum to 17. the shortest solution wins :p
 
I hate these sort of mental ability tests
 
1+7 = 8 < 17 (fail)
 
@RonniSkansing 1 + 7 != 17
 
917 =p (parrot)
 
4:50 PM
917
@RonniSkansing you cheat
 
917 mod 17 = 16 != 0 (fail)
 
ehh
 
I wonder more about solution rather than an answer
 
without scripting?
 
there is no solution, because there is no such number
 
4:51 PM
I know the answer and I got it in kind of a short way with using just basic school math
 
@AlmaDo means it should support n=17 for mod 17 and mod 100
 
@Ekin but the limitation is for sum of digits
 
gah
 
it refutes 17
 
find another coprime :P
 
4:52 PM
it wont work
 
you don' have to type the number itself
just the way to get it
 
the sum if even and odd digits would have the be divisible by 17 (that's how you would know that it is divisible by 17 ... if I am not mistaken)
 
@LeviMorrison Maybe not directly in the same but I've seen people using it on the parent and again on the child like bugs.php.net/bug.php?id=75607
 
if someone wants I can post solution in pastebin or smth
 
4:54 PM
@pmmaga For generics I think this is okay. The key issue right now is same class.
 
wait, lemme get my notebook. I'll do it the old school way
algebra ftw
 
15317
 
@LeviMorrison I don't use traits
 
@Ocramius An email to internals it is, then.
 
they are overall just a source of headaches
 
DOMNode::$prefix not NULL when unspecified – #75624
 
@LeviMorrison sorry power went off...no but want to achieve accordion on front end
 
I got it as well tho (let's not acknowledge the scripting thing)
 
I wonder if there's a shorter way to solve it than I did
@SaitamaSama I said no scripting ..
 
4:58 PM
@AlmaDo Since you have solution % 17 == 0 then you know x * 17 == solution exists. The only way you get a number that ends in a 7 is to multiply it by 1, 11, 21, etc. That's one constraint that wipes out a bunch of possible solutions.
 
hmm
 
> let's not acknowledge the scripting thing :P
 
anyways, time to leave :p
 
The next step is to find ways to formalize the other constraints.
 
4:59 PM
@LeviMorrison yeah but without a script you'll have to do lots of arithmetic till you get to the point :p
 
YAY! I replaced SOAP with urlencode(serialize($garbage))
 
@AlmaDo No, my point is if you formalize a lot of the constraints on x then you don't have to check many numbers.
 
because nobody was using the API anyway, so I can make it a massive security issue :D
 
@AlmaDo "thus sum of digits P is 9. This means P is divisible by 9." hmm...
 
@LeviMorrison that was my approach. I knew that it had to end in 01 (as otherwise there's be a 10's place component of the multiple). That means the 10's place either must be 0, or a number who's 1 place that when multiplied by 7 is 0 (which is only 0). So I knew the trailing must be 01. Then I knew that the "leading" must be such that when multiplied by 17 resulted in a number who's digits summed to 9. That's a multiple of 9, therefore it's 9. Hence 901...
 
5:01 PM
@Ocramius brilliant
next step, find a better job and leave somebody else to deal with it
 
@ircmaxell I didn't keep going but you found that constraint much faster than I would have ^_^ Nice.
 
The 01 constraint I found quickly. The leading 9 was a bit slower. I wasn't sure 901 was the smallest multiple, but I knew it was one
 
The leading 9 is the part I wouldn't have seen quickly.
 
I didn't see it quickly. I played around with a bunch before realizing
 
if I'd find 9 too, next thing I would consider would be n=17 (mod 9 . 17 . 100)
 
5:13 PM
I am new to chat room : ) can scripting coding question can be asked here.stackoverflow.com/questions/47524868/…
@FélixGagnon-Grenier That is copy paste error
@FélixGagnon-Grenier Edited my Question
 
@jacktriun scripting questions can be asked, but "I want to do this" is not a question. If you actually get stuck on a specific thing, AND googling for that specific question doesn't give any results, then it'd be appropriate to ask here.
 
Wrong Mime-Type returned by mime_content_type function with some PDF – #75625
 
5:28 PM
!!lxr magic
 
[ /ext/fileinfo/fileinfo.c#45 ] struct magic_set *magic;
 
posted on December 04, 2017 by CommitStrip

4
 
Hi, how it is called that type of comments in php like:
/**
*
@ some things i don't understand yet
*
*/
 
@Feeds "PHP and Scala are basically the same thing" lol
@Edenwave You mean PHPDoc?
 
I dont know
/* @var bool */
 
5:35 PM
Yep, that's PHPDoc
 
I need to research that so :)
thanks @Machavity
 
they are generally referred to as "docblocks"
 
@Danack infact that link refers to question which i asked and solution which i tried.but couldn't achieve
 
@jacktriun no it doesn't. There is not question in that link. "i would like to add" is not a question.
 
it's basically same as writing "something is not working. help"
there isn't anything tangible to answer ... and if you just want people to write free code for you, then you are shit out of luck
 
5:53 PM
so can i post external link here
external website link
@tereško not asking for shit free code
 
6:05 PM
 
> "I want to do this" is not a question. If you actually get stuck on a specific thing, AND googling for that specific question doesn't give any results, then it'd be appropriate to ask here.
 
facebook.com i want to du dthis
 
6:22 PM
Does anybody know what PHP_BINARY is for Apache?
 
@LeviMorrison a little. it avoids confusing with =>. anyway, the idea is an abbreviated syntax for our existing closures and maybe other functions, for when you want to just return an expression, rather than “short closures”
 
@kelunik likely httpd.exe
or whatever the apache binary is on that machine
hmm, though I might be completely off. I just fired up my vm and it only mentions PHP_BINARY for serializer handlers
@kelunik string(0) "" on PHP Version 5.5.9-1ubuntu4.21
 
Interesting, thanks. /cc @Trowski
 
6:38 PM
on cgi it is string(17) "/usr/bin/php5-cgi"
but it also doesnt show up in the phpinfo
should it show up in phpinfo?
 
@kelunik I could do dirname(PHP_BINARY) . "/php" and if that doesn't exist then try PHP_BINDIR . "/php".
 
@Trowski And if that doesn't exist error out?
 
@kelunik Yeah.
 
We could also default to "php" otherwise.
 
@Andrea So class C { function f($x) = $x * 2; } ?
 
6:42 PM
@LeviMorrison sure.
I was inspired by some language but forget which
 
@kelunik Actually that would probably be best.
 
I don't think => is any different, really. Dart allows => there.
 
yeah, I don't know if one is strictly better
 
The "ambiguity" of => does not actually exist on a technical level.
We need a distinguishing prefix we can agree on and we need semantics we can agree on. Those are the two contention points.
The first is something of a bikeshed.
The latter is completely legitimate and I'm not sure how to go forward.
 
@kelunik Does the command which php work on windows?
 
Anonymous
6:52 PM
did SO remove the question filter by tag option?
 
@Trowski What's the gain? It doesn't matter whether we determine whether it exists and error out or whether the process launch just fails.
 
more i know about programming more i hate my life
 
Hi , i need help with my php script
 
Anonymous
@tereško can you see this i.stack.imgur.com/xuYQfm.png
 
Anonymous
6:55 PM
in SO i mean
 
@samayo yes :-(
 
i need to send some data to another php page from one page on load.
 
@kelunik Seemed like the most logical way to try and automatically locate the executable.
 
@samayo this is first time I actually see such interface
 
and after processing data from second page i want to print the response again on first page
what is the best way to do so
 
6:57 PM
@HarkeshSinghChauhan ajax?
that description was really vague
 
@Trowski Path search works.
 
o/
 
let me try to make it more clear. i have landing page (landing.php) and response page (response.php). I want capture Ip address of the host from landing.php and send to response.php to check if thats a valid ip or not. After checking send that response to (landing.php) if that person is authorised to access the page. If not redirect it to different page.
 
Why are you talking in terms of pages and not in terms of functions you can call?
 
but all this i want to do onpage load of landing.php
 
7:04 PM
@kelunik Even better idea.
 
Sounds like landing.php can make a few function calls either before or after rendering.
 
i created a function capturedata() of landing .php now i do not know how to send that data to response.php
 
Normally you persist that data somewhere (database?) and then push in a reference to that data in the page.
Actually stapling the data to, say, a form is really a mess.
 
i did not get it. can you show me little way so that i can move forward on that way.
 
Like on your first page you'd capture whatever data you need, then save that into a database record or some other place that's persistent. Then on the page you can generate a reference to that, like a random ID value.
This is pretty standard stuff in any framework. If you're doing home-rolled PHP you may have a lot of work to do.
 
7:08 PM
i am using core php
no framework
 
Then you've got a ton of work to do.
 
Like you're going to have to reinvent maybe three or four wheels.
You could save some time by using an ORM.
 
can i try using ajax on landing.php
 
Honestly a database is 10x easier here.
AJAX for slinging data is just exposing you to the whims of any users you might have.
 
7:14 PM
@tadman that's not how it actually works. Picking ORM as your "default approach" usually leads to terrible codebase
especially if you pick some active-record based ORM
 
@HarkeshSinghChauhan No framework is fine but utilise some libraries.
 
ok
@tadman did you got the what i am asking?
 
@HarkeshSinghChauhan why would you need to "capture IP"?
the IP address is already available in $_SERVER
both in your landing.php file and in any other request, that goes to PHP
 
@tereško i have store some ip's in db. on which i want to give access if landing.php.
so i want to compare IP from landing.php from store IP in db
 
then do it
you don't need to make another request for that
 
7:26 PM
and this process i want to do on response.php
 
why?
this is making no sense
why do you insist on using a separate request for it?
 
ok then tell me how to do it
shall i share the code
 
no
you should explain what problem you are ACTUALLY trying to solve
instead of asking us to help to make your "solution"
 
ok brother.. if any user loads landing.php and his ip (some more info) falls in the range which i already stored in database. then he will get access to full page (landing.php) else he will be redirected to another page.
 
7:39 PM
@HarkeshSinghChauhan the question @tereško is asking, is why do you need to get the IP of the user, for what purpose does that serve?
 
fuck it, I dont have time to pull the necessary information out of this one
 
its just to check if its a Bot ip (VPN services) or actual residential IP (actual user).
 
why can't the code for that be in landing.php?
 
8:03 PM
i think i am pulling it long. can you tell me how to send ip from landing.php to response.php where i can compare it with ip stored in db and recieve response on landing.php back.
 
8:26 PM
@JoeWatkins There's been a number of requests for a new release of pthreads to use with PHP 7.2. Other than the couple of Socket-related PRs that need handling, is there anything else that should be done before a new release is made?
 
@Wes probably the cutest thing I've seen all day
 
@Wes this makes trying to work with LDAP queries slightly bearable
 
Wes
:D
 
this shit is so confusing
 
8:36 PM
@tereško Let's just agree to disagree. There's many ORMs. Some good. Some bad. Which is which is highly subjective and often a reflection of your needs, not anything universal.
@HarkeshSinghChauhan What you need is a function that checks if they're in the list or not, then call that function on every "restricted" page to prevent access.
If you do this check just once and then redirect there's nothing to prevent someone with the URL from accessing the "protected" page.
This check has to happen for every page load. No exceptions.
Another thing to keep in mind is getting the user's IP address from the headers is non-trivial. There's about a half dozen ways that information might be encoded.
And worse, there's ways it can be spoofed which you need to disregard.
 
8:52 PM
oh, how would you spoof the IP?
if I setup an apache server now, how would you spoof my ip?
 
I think he might be referring to HTTP_* headers being used for IP use as commonly and incorrectly done?
 
from what I've read, it's rather difficult to spoof an IP
 
I am not sure what he is refering
 
I think he means one's own IP address
so that the recipient server is given a different address than what the spoofer originally has, but it's still a bit difficult to do
 
yeah, doesn't the server need a reply back to complete the connection at least for TCP. I dunno, I have no idea what I say these days.
 
8:56 PM
It's difficult to spoof an IP for TCP purposes, but it's not hard to confuse a web server into thinking you're an address you're not using various HTTP headers.
Remember the actual "IP" as in the remote endpoint and the user's IP often, legitimately, diverge.
 
@RonniSkansing I would ask you nicely to setup an open proxy on your Vhost. Plx and thx. :)
 
NAT, proxies, etc.
 
?
You would have to guess the ack to spoof a IP
that's like +billion
 
This isn't IP level, it's HTTP level.
People do this all the time to confuse US-only streaming services.
"Yeah, I'm 8.8.8.8, it's cool" they say in the header.
X-Forwarded-For, X-Real-IP and so on.
 
thats forward headers
I am saying
 
8:59 PM
That's often how a user's actual address is indicated. It can also be spoofed. Code to tell one from the other can be a bit...involved.
Like if your app is deployed behind an Nginx proxy you'll see everyone's IP as the Nginx IP, which is bad. So you need to use those headers.
If you're directly exposed then you'll have to subjectively interpret those headers since they can't (always) be trusted.
 
so you can spoof $_SERVER['REMOTE_ADDR'] ? if I setup a test?
 
That's the only var I trust to get an IP
 
Because I would love to know how you would do that, it would be practical for my next pen test
If the OP had a trivial setup, and you are not able to easily spoof REMOTE_ADDR, then I do not understand => (Another thing to keep in mind is getting the user's IP address from the headers is non-trivial. There's about a half dozen ways that information might be encoded.
And worse, there's ways it can be spoofed which you need to disregard.)
it would be trival, and you would not be able to spoof it?
or maybe I am misunderstanding all of it
 
so... I just joined a freenode channel... I have no idea what's up with that
 
why doesn't phpseclib upload the full file
 
9:12 PM
@RonniSkansing annoyingly, 'modern' webservers, with their multiple layers in front of them, mean that most of the time you only get the forwarded for, from the end user.
 
$sftp->put("x", $y,\phpseclib\Net\SFTP::SOURCE_LOCAL_FILE)
 
@Danack sure with proxys and what not
 
@FélixGagnon-Grenier irccloud.com may make your life easier if you aren't using it already.
 
but if somebody just pops a digitalocean, or etc, sets up apache and php, I dont see the issue?
 
@Danack No, I am not aware of that, it's my first time joining an irc "node" (I believe that's how we name them?). thanks for the advice!
 
9:16 PM
but reminds me I should make a extension for setting all the standard forward headers
 
Mounting improvements – #75626
 
@FélixGagnon-Grenier did you mod it?
 
"it"?
Morrowind?
 
yes
you can basically get it looking close to modded Skyrim
 
yes, downloading the graphics extender now
tbh, I don't understand. I've played all the elder scrolls games since morrowind, and I literally cannot find any of the later ones better than the previous.
 
9:29 PM
In terms of story?
 
That, but mostly... atmosphere?
 
well, I think skyrim was better than oblivion
 
hmmm... yeah maybe, I have not played that much oblivion
elder scrolls online is a gigantic piece of pena
 
Wes
9:42 PM
this was funny af :D
 
9:57 PM
Insurance policy has 2 different case. Bikes > 125cc and bikes < 125cc -_-
 
@FélixGagnon-Grenier You didn't like ESO?
 

« first day (2606 days earlier)      last day (2342 days later) »