« first day (1854 days earlier)      last day (3112 days later) » 

12:00 PM
Otherwise:
 $ php -r '<?php*1;'
PHP Parse error:  syntax error, unexpected '<', expecting end of file in Command line code on line 1
 
⚙ leigh@localhost  ~  cat > test.php
<?php*print 1;
⚙ leigh@localhost  ~  php test.php
1%
 
Which PHP version?
 
7.0 branch (not master)
master probably affected too
let's 3v4l and see
 
12:02 PM
Didn't know we still had <? as open tag.
 
I thought it was off by default too
 
Anonymous
The only thing removed was the ASP style. <?%
 
A great puzzle ^
 
@Leigh it's on by default ("default" being "php -n"), the default php.ini files turn it off
 
@Sajad No, Cheryl is just being an ass, I mean, giving you 10 dates instead of just telling you her birthday?
 
12:09 PM
@Epodax :D
 
@salathe right, makes sense, I don't run with a php.ini when testing this stuff
 
@Sajad But have you figured it out?
 
yeah
 
Then tell me, cause I'm unable to crack it
 
you don't want to think about it? it is exciting
 
12:12 PM
I am thinking about it, but it's not making sense, might be because I'm burried in a server as well.
 
@Sajad - If that's Cheryl's response to a perfectly innocent question, then I'm not sure I want to be friends with her
 
@Sajad Bernard and Albert swapped details, simples
 
@MarkBaker Agreed, she's being a ass.
 
@MarkBaker ha ha ha
 
@Leigh Yea, but we still don't know when the birthday is!
 
12:15 PM
Well to start, it can't be May 19th, because otherwise Bernard would have known.... and if Albert knows that Bernard doesn't know, then he must know it's not in the month of May
 
@Epodax the key is, they both "know" the other person doesn't know
 
@MarkBaker good job, go on ...
 
Yeah I can't follow that either :p What I don't understand
is why would B ever think A would know what the full date is
because there's at least two possible answers for each month
 
@Leigh yes it is
 
@MarkBaker But, wait what? How do you know that Bernard know that it's not the May 19'th?
 
12:16 PM
But for Bernard to know from my previous, he must have been told either 15th or 16th (the other dates in the eliminated May)
 
A knows B doesn't know, because the month he was told has overlapping days,
 
@Epodax - there's only one 19th in the list
 
I'm confused
 
There's only one 18th, and one 19th, so for A to know B doesn't know, it must be a month without 18th or 19th
so it's July or August
 
@Leigh Only has overlapping days* That's important
 
12:18 PM
So if Bernard knows it's either the 15th or the 16th, and he knows what month it is, then he now has both month and day
 
So? How does that include / eliminate it? How do you know that she didn't tell A the 15th may?
 
It all makes sense now
 
do you want to think more or I publish the answer ?
 
Lemee work it out :p
 
12:18 PM
I still don't get it
 
OK, @sean - I'll hold off continuing with the logic
 
July 16th
 
OH
I have it!
 
@Leigh correct
 
^5 Leigh
 
12:20 PM
helps to draw it on paper and cross things off :)
 
@Epodax - she didn't tell A 15th May, she only told A the month, not the day
 
I'm still lost, let's say she told Albert July and Bernard 16th, it can still be any of the 9 other days, just because Albert knows that Bernard doesn't know and the other way around, doesn't eliminate the other 9 D;
 
@marcio This looks vaguely similar - github.com/winterbe/java8-tutorial#functional-interfaces /cc @LeviMorrison It also suggests the obvious solution to having more than one method defined in the interface that extends callable; just don't allow that and make it a rule that only the __invoke method can be defined by that interface
@Epodax have you gotten some paper and started crossing things off yet?
 
@Epodax A knows B doesn't know, this excludes months that have unique days, this is your starting point
 
Remember, Albert is told either May, June, July or August.

Bernard is told either 14, 15, 16, 17, 18 or 19

Let’s go through it line by line.

Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard doesn’t know too.

All Albert knows is the month, and every month has more than one possible date, so of course he doesn’t know when her birthday is. The first part of the sentence is redundant.

The only way that Bernard could know the date with a single number, however, would be if Cheryl had told him 18 or 19, since of the ten date options only these numbers appear once, as M
 
12:23 PM
I still don't want to be friends with Cheryl anymore
 
:D
 
Horrifying idea: a fixer for php-cs-fixer that changes class and variable names to random emoji. 3v4l.org/eJNis
 
@Amelia make it add non-visible characters and it would be golden.
 
Why would you load laravel? new 💩?
 
12:29 PM
@Sajad I'm starting to get it, but i'm still not 100%
 
@PeeHaa Actually, that's zend framework 2 right this second for me
 
Same 💩 different day
 
Or rather, [[[[[[]]]]]]
Which should always be a valid name for zf2
@Danack you're evil. Brb attempting that
 
It was not me! I was led astray! It was the other guy!
 
@Danack In PHP I'm not sure how we'd associate a lambda to a given interface.
 
12:36 PM
@Danack they still have a way to type a function with Function<Arg1, Arg2,..., Return>
 
You could say ad-hoc that the signature matches, but that doesn't mean it shares the semantics. In Java when you declare the lambda you'd associate it with the correct interface then. We don't really have that in PHP.
 
@LeviMorrison Run time checking only.....as people will want to be able to pass plain functions that have the correct signature.
And if they want semantic checking, they can use a class that has the correct invoke method....or just use a class.
 
So what you want is to be able to pass function (T $v): R {} to function function foo(Mapper $m); where Mapper is interface Mapper { function (T $v): R; } ?
 
hmmm
wondering how typed property syntax should work
 
It's what Java calls a functional interface
 
12:40 PM
public int $a, $b; - is $b an int? I would assume so, but this is a little trickier to implement :)
 
An interface that has only one abstract method (their ifaces can have non-abstracts too)
 
"their ifaces can have non-abstracts too" - that sounds a bit too crazy for me btw.
 
@Andrea yeah, I'd see it like this, just like in C
 
ditto
 
php/sql question: I have a column that is unique, but for some reason the table it belongs to is allowing me to insert mulitple rows with a null value for the unique column.. why?
 
12:42 PM
@nikita2206 yes, pass it successfully or have a sensible error occur on the passing, not a horrible one later when you try to use the function and it's got the wrong signature.
 
@Danack I'm not sure about it. Might be useful, I haven't heard any feedback about it yet
 
so I just have to figure out how to make it work, hm
 
@Porlune because null != null probably....let me check the docs.
 
even so, why would it allow me to insert the same value over and over again?
 
@Danack it could be done, why not
 
12:43 PM
Honestly I'm not sure if any of this callable stuff is worth the pain.
 
@Porlune because that's the way it works...null isn't a value, it's the complete lack of a value.
 
ah.
hmm.
 
/glances at RFC list.......lets move on with our lives.
 
any idea how I can insert an actual null value?
 
@LeviMorrison it's pretty isolated, I didn't feel any pain even when I had to fix stuff for opcache
if you're talking about implementation complexity (it's actually pretty simple)
 
12:45 PM
@Porlune What are you actually trying to achieve?
 
@LeviMorrison pain?
 
(so as i don't answer the wrong quetion).
 
@nikita2206 Talking about user pain.
 
I have a table that keeps track of locations. When someone doesn't have a location to save, I want to assign their profile a null value so that everyone who doesn't have a null value has the same reference to the locations table.
 
Here's an analogous situation:
 
12:46 PM
so the locations table needs exactly one row with a null value for it's unique key
 
The proper regular expression for an email address is an absolute nightmare, and even that has to strip comments before running.
 
because the profile table references that.
 
@Porlune youcan set NULL in the table properties
 
So what do many reputable places do? They just check \.+@\.+ for the most part and then send the email. Why? Because even if an address is valid in the syntactic sense the only way you can know if it has a recipient is to send an email.
 
@Yayo88 yes, but I don't want it to allow multiple rows with a null value in the unique column.
 
12:47 PM
In our situation the callable pseudo-type is basically the email's @.
 
$ sapi/cli/php -r 'class Foo { public int $x; }'
yay
 
Is it even remotely possible this thing can be called? Okay, just call it.
Let the user sort the type issues.
 
@Porlune Whats your db structure?
 
@Porlune I'd be tempted to just hard code it. In your deployment script (or by hand if you're even lazier) check that the 'default' location is present, or add it as necessary and then save that ID somewhere. When you go to add a user, if they haven't selected a location, just use that default location ID instead.
 
id, name, location
 
12:49 PM
CREATE TABLE gmap_locations (
place_id varchar(128) UNIQUE,
formatted_address varchar(256) not null,
latitude varchar(64) not null,
longitude varchar(64) not null,
location_type varchar(64) not null,
locality varchar(64) not null DEFAULT "",
administrative_area_level_1 varchar(64) not null DEFAULT "",
administrative_area_level_2 varchar(64) not null DEFAULT "",
country varchar(64) not null,
postal_code varchar(16) not null DEFAULT ""
);
I'm just going to settle with using NULL as a string.
 
Your fields are set as not null
 
.. not the unique one..
 
Out of interest, why are you using varchars for latitude and longitude?
 
if its unique you can't have multiple strings of "NULL"
 
@LeviMorrison The argument for it is that it makes debugging easier. The error occurs when you pass the wrong thing to be used as a callback, instead of erroring when it is called. (I'm sure you're aware of this already). But yeah......this is one of the factors of why I think slipping it in by a magic interface is a better solution, than adding a completely new concept to the language.
 
12:51 PM
because it makes interoperability much easier when I deal with strings until I need the value.
 
@Porlune if its unique you can't have multiple strings of "NULL"
 
@Danack Well... in a way an interface that defines only an invoke having special semantics is a new concept.
So I'm not completely sure what you mean.
 
It's smaller change to introduce than adding a new typedef or similar.
 
Yayo.. that's my goal.. I want only one column with a null value. But php doesn't send a null value the same way mysql expects a null value.
 
And it's easier to explain to junior devs.
 
12:53 PM
$ sapi/cli/php -r 'class Foo { public int $x; }'
Wow, types!
$
^^
 
so instead I ended up with hundreds of rows of null in the unique field.
 
@Porlune Why noth vae an extra column? is_valid
@Porlune I would validate this all before inserting into your db
 
ugh why did I ever make return types be weak, they should've been always strict
 
yayo, I'm not sure we're on the same page. And yes, I validate everything before insertion.
 
@Yayo88 That would make writing the join be incredibly annoying...
You'd need to have conditionals in the join........
urrrrgggh....
 
12:55 PM
also it doesn't fit my scheme.
 
(or any normalised scheme.)
 
@Danack well, to explain that interface with only one method can be a type of a callable is... not easier, it's more indirection
 
a users profile simply has a null location if they don't have a valid one.. that's much simpler than using an extra column to achieve something similar.
thanks for the help by the way! :)
 
@nikita2206 the method would be __invoke, rather than being nameable methods.....and yeah interface Foo { function __invoke();} is already a callable thing.
 
And also, this callable thing we are working on is not related to typedef in any way. typedef is something that can be added later. But even without it you already will be able to "typedef" with the help of __invoke
 
12:58 PM
@Porlune btw you could just make sure you're doing a left outer join, and handling the case where the location data is missing in code.
 
@Danack so basically even though it's not my intention, this will work
ah wait, no
 
yeah...was going to say; plain functions as the param
 
in the other direction it will work
yeah this thing... It could be added too
 
Is there a draft of that rfc?
 
WHY ARE PEOPLE EMAILING ME WITH THEIR PHP QUESTIONS
 
wait - checks the date.....IT'S UNLUCKY FRIDAY!!!1!
 
and the implementation is here https://github.com/php/...
3
 
headshot
 
@Sajad i have a riddle for you then:D goodriddlesnow.com/riddles/view/2636 promise it's not Rebecca
 
1:23 PM
@Machavity crap you're making me want fries
$ sapi/cli/php -r 'class Foo { public Foobar $x, $y; public int $a; }'
Wow, types!
Type hinted property! 8, Foobar, 0
Type hinted property! 8, Foobar, 0
Wow, types!
Type hinted property! 4, , 0
progress
[Fri Nov 13 13:29:37 2015]  Script:  '-'
Zend/zend_string.h(121) :  Freeing 0x110057840 (32 bytes), script=-
=== Total 1 memory leaks detected ===
wlep
 
heh
finally someone decided to resurrect this
I wonder how you want to deal with nulls
 
fixed the memory leak ^^
@nikita2206 same way everything else does?
 
@nikita2206 After the constructor runs assert that the properties are of the proper type.
 
references are the big problem
 
Prevent references being taken.
 
1:36 PM
@Machavity I often sing Fried Eggs
 
@LeviMorrison yeah that's my approach
 
yeah was gonna say this, just don't accept this shit
 
But I wanted mine scrambled :(
 
Hmm. How do I enforce type checks on property writes? Doesn't the Zend engine fetch a pointer then write to it?
 
there is a bug in lxr.php.net/xref/PHP_MASTER/sapi/fpm/fpm/fpm_conf.c#1576. The global section is called General, when it should be named global. lxr.php.net/xref/PHP_MASTER/sapi/fpm/fpm/fpm_conf.c#1313 refers to "global" and the default conf gives it as global, too. Can I just change the label and send a PR for it or does it need more effort?
 
@Epodax See this chat then
 
@LeviMorrison huh.
How the hell is that able to work? Actually, how does __set work? Maybe I misunderstood how Zend writes to properties
 
@Andrea Here's the default implementation: lxr.php.net/xref/PHP_MASTER/Zend/…
 
I'm wondering about the opcodes
 
1:59 PM
krakjoe@fiji:/usr/src/apcu$ cat t.php
<?php
$t = new stdClass;
$t->prop = "Hello";

?>
krakjoe@fiji:/usr/src/apcu$ phpdbg -p* -rr t.php
function name: (null)
L1-3 {main}() /usr/src/apcu/t.php - 0x7fed662e4380 + 6 ops
 L2    #0     NEW                     "stdClass"                                @0
 L2    #1     DO_FCALL
 L2    #2     ASSIGN                  $t                   @0
 L3    #3     ASSIGN_OBJ              $t                   "prop"
 L3    #4     OP_DATA                 "Hello"
 L3    #5     RETURN                  1
 
I just did the same on 3v4l. Yeah, ASSIGN_OBJ
So, when do we do FETCH_OBJ_W?
 
posted on November 13, 2015 by nlecointre

/* by eXes */

 
My first php-src PR: github.com/php/php-src/pull/1638
 
:D
 
@Jimbo gotta start with something
 
2:13 PM
@Gordon Leagues ahead of me mate, my first OSS contribution was a missing apostrophe in Symfony docs xD
 
@Gordon ^5
 
OCD is important
 
@Epodax :-)
 
@Gordon - github.com/php/php-src/… - got kinda hacked about a whole lot before it was finally accepted
Never did get any voting karma for it though
 
2:28 PM
..
How does Albert figure out the right date at the very end?
If the possible dates are July 16, August 15, and August 17. Bernard announces they know the date because all of the days are unique at this point
Yeah I get it.
 
@JoeWatkins There isn't any support for anonymous classes to implement interfaces via a variable is there? e.g. $interface = 'Foo'; $obj = new class($fn) implements $interface { }
 
Your fault.
 
2:53 PM
Some sort of chipnado with a calm center
 
For some reason, every time @Andrea writes "fault" I think she refers to herself in that sentence
/me runs
 
@AlmaDo same here
 
I'm not alone!! :p
 
@Andrea :)
 
@Andrea They look like very disappointing french fries to me.
 
3:03 PM
@Danack this is not similar at all. In java you create an interface using the "@ functionalInterface" annotation to limit that given interface to have a single method, when implementing the interface you have a typed variable "Converter converter = <implementation>..." which will ensure the implemented method has the right signature and to call the "anonymous function" you're actually calling a method from an anonymous object "converter.convert(args)".
@Danack To have something like this in PHP you would have to do basically what I said here.
+ you would need to have short closures to make the verbosity at least palatable (as java did) xD
Btw, I think java did a horrible job there.
 
Also it turns out Function<T, R> works for only one input parameter so functional interfaces is probably the only way to type lambdas with multiple arguments
Looks like it's just a crutch because they don't have variadic templates
 
3:21 PM
not to mention that on this Java apocalyptic scenario you'd never be able to pass a "function(){}" into an argument list like "function(callable($a, $b, $c) $a) {...}" even though the callback is safe (unless we bend the interface rules a lot)
 
Um, I'm confused here folks.
 
@DanLugg that was fixed on RC7
 
I see that, but what about 5.4 through 5.6?
I could have sworn this worked before.
Wait, fixed?
 
@DanLugg statics, and statics. -1
 
@ircmaxell Yea yea...
 
3:30 PM
@DanLugg nope, you want "propected" there, not "private"
 
But I want to hide the property behind the method... I thought LSB still worked on privates
Ugh.
 
@DanLugg oh, then you want to keep the "private" and use "self" instead 3v4l.org/qUOY0
 
But doesn't self use the defining class as context, not the calling class?
Fuck it, I'm using a map.
 
I have a question
in movies, when there is a car-chase with shooting, it's often seen that someone shoots out the back window .. so .. why nothing happens to the front window?
 
Because then that'd end the car chase. Or could.
 
3:38 PM
I mean, does the bullets just give up in the middle of the car?
 
@tereško because physics
 
The best way to answer (beyond "It's a movie") is that windshields are often tempered glass. So even if you shot them, the window wouldn't shatter. I can't say the same for a rear window
 
You mean if someone shoots from the car A through the back window, why nothing happens to the front window of the car A? // ah I guess my engrish is still bad
 
@tereško obligatory
@Machavity Well, I think we're going to need a field test for this.
 
@nikita2206 yes
 
3:41 PM
Bring your car.
 
if the bullet is important enough it will be in slow motion and you will know the entire trajectory, the supporting bullets don't have a complete trajectory.
3
 
if (!isset(self::$classReflectionMap[static::class])) {
    self::$classReflectionMap[static::class] = new ClassReflection(static::class);
}
return self::$classReflectionMap[static::class];
Filthy, filthy filthy filthy... now I can move on.
 
Also, there would be some net loss of velocity on the bullet (not a ton but some). Relevant video
 
@tereško what if they are not real but only bullet effects special-effects.wonderhowto.com/how-to/…
 
I know they are not real. But I would like to see a full effect and not just a half of it
it;s like making a CGI explosion but only rendering a half of it
 
@DanLugg Could you PUT any more colons in that?
 
@Jimbo No, but I could put cacti in a colon.
BAM
 
BOOM
That was pretty epic tbh, nicely done
@tereško Not yet, I've ordered them off eBay, am finishing off Battlestar Galactica atm
 
user1804599
 
@Jimbo you do know that torrents are faster
right?
 
3:57 PM
@Elyse self::laughAt(); // we're good for that in PHP
 
@tereško I haven't torrented in years, get all my music / movies legally now. Feel better for it, more honest :-)
Same with games
 
I get games legally, because the service is better and prices are fair
 
But not movies / tv? Tbf, they'll all be on-demand eventually anyway
I do have that popcorn time app, haven't used it in a while though because my ISP are wankers
 
@Jimbo they deactivated the popcorn time servers recently :( the catalog is gone, you need to search the torrent yourself and paste in the app
 
awww
 
4:02 PM
If you can afford it, buy it.
 
it's funny how content producers took so long to understand they could use online services to save their industries. I have Spotify, Netflix, Steam, some paid TV channels have stand alone online access.
 
posted on November 13, 2015 by nlecointre

/* by Naxilolz */

 
lol. the beginning of the rise of the valkyrie seems strangely fitting to that gifs of cats fleeing the shit out a window
 
@Sherif hm?
 
Anyone around familiar with ant? Just asking since it's not really PHP specific in that respect
 
4:12 PM
guys
  class ClassAutoloader {
        public function __construct() {
            spl_autoload_register(array($this, 'loader'));
        }
        private function loader($className) {
            include $className . '.php';
        }
    }

    $autoloader = new ClassAutoloader();

    $obj = new Class1();
    $obj = new Class2();
in here this will only call Class1. why ?
 
hi.. I asked a question in SO : http://stackoverflow.com/questions/33695383/chat-application-using-websockets/33696217

Its regarding making a chat application using websockets for a very large no. of users. Got answers but not yet convinced with them. Can any of you help me out?
 
@underscore ClassAutoloader::loader() can't be private
since spl_autoload_register is called from a public scope.
 
@vignesh Don't use php
 
@PeeHaa: hmm.. it creates some problem?
 
It might create problems sooner
 
4:15 PM
@Sean but it inside the class . spl_autoload_register calling inside the class
 
@Tyrael hmm, I think I was referring to the ssl config for svn.php.net being messed up. It's using a pretty outdated cipher suite. I can't remember if you made those changes or someone else.
 
But every time I see a question about "huge number" of users on SO I do ¯\(º_º)/¯ because in reality in 99.9% of the cases it's just a hypothetically question
 
@underscore Yes, you register the autoloader inside the class, but the first argument of spl_autoload_register is callable. When your autoloader triggers further down the line, it's called from outside of your class (someone call me out if I'm wrong here)
 
callbacks/ callable
 
4:17 PM
yeah
i'm also reading it
 
It's just an object
 
Would an ant related question fall under serverfault?
 
@Sean it has been voted up
who voted up if it's wrong there
 
Well, does your script error at all @underscore?
How do you know it's not calling up Class2
 
Trying to load Class1 via ClassAutoloader::loader()
it's echo only this
@Sean
 
4:25 PM
> When using spl_autoload_register() with class methods, it might seem that it can use only public methods, though it can use private/protected methods as well, if registered from inside the class:
@Sean oh ....sheeeit.
 
@Danack so why it;s giving me only the first
any responses ?
 
is @Jimbo here?
 
@Sherif I'm not even sure I have access to svn.php.net anymore, let me check
 
@underscore What's your PHP version?
 
Mission Impossible 5 was actually really fun movie
 
4:39 PM
5.5.9 [ 5.5.9-1ubuntu4.14 ]
 
nope, it seems I don't have an account there since we moved svn.php.net to svn2.php.net
will drop a mail to systems
 
Is it just me or does the VS logo like that look like a TIE bomber?
 
Isn't that where we also got this?
 
php codebase is C89 compliant right? Does C89 support initialization of variables with expression? as in uint32_t x = foo->bar;
 
I'm still mildly irritated that the token is T_SPACESHIP.
@nikita2206 That will work, yes.
(but not if it's in the first part of a for loop)
 
4:46 PM
@LeviMorrison IKR it should be T_TIE_BOMBER
 
@LeviMorrison aight thanks
 
@nikita2206 That's the only thing that makes C89 somewhat bearable...
@LeviMorrison I'm still mildly irritated that it made it in at all :)
 
Oh well.
 
@LeviMorrison @Machavity @NikiC ಠ_ಠ
 

« first day (1854 days earlier)      last day (3112 days later) »