« first day (1825 days earlier)      last day (3133 days later) » 

6:00 PM
@DanLugg What are you on now?
 
@NikiC Closure->free_obj -> triggers freeing of handler object holding closure -> handler object decrements refcount of Closure. Closure refcount is now at 0 after free_obj
 
@DanLugg that consultant is still there?
 
@LeviMorrison 5.2/5.3
 
Yeah. I think 5.6 sounds good :D
 
@marcio Sort of. He's being ... phased out.
 
6:01 PM
@bwoebi okay ... I still don't get it
 
in case we have dtor_obj, the Closure refcount is already decremented in the general objects dtor call… and then it's zero before it ever reaches Closure->free_obj
 
I had a coworker leave here and he found out after he started they were on 5.2 (rabidly so)
 
I wouldn't tell management this, but I would do a pit-stop at PHP 5.4 because that's where you will have the most issues. Once solved then jump to PHP 5.6.
 
@LeviMorrison I considered this, however, it's all going to be such a clusterfuck that 5.6 is fine IMO.
Even 7, realistically; we're looking at a refactorbuild
 
@NikiC in general, zend_objects_store_del() efree()'s objects, but zend_objects_store_free_object_storage() does not.
 
6:03 PM
@DanLugg May as well use Perl 6 right?
 
@bwoebi Yes
 
@LeviMorrison I'm going to start writing new modules in brainfuck and hardlink the interpreter into our include path.
 
@LeviMorrison Python 3 or GTFO
 
Is there a translator for PHP opcodes to Brainfuck?
 
@NikiC well, yep. And because the Closure is only released inside free_objects_storage(), it never gets freed. … In case we free it already at the zend_objects_store_del() stage, it triggers the efree().
(note that we have here a reference from the Closures to the internal object and back)
 
6:06 PM
@bwoebi What you are saying there is literally just "there was a leak"
If free_object_storage doesn't free something, that's because it leaked
Ahhh, so you're saying there was a cycle?
 
yes
 
lol
could've said that right away ^^
 
thought that were obvious when looking at the test ;-D
 
@bwoebi Er, I didn't get as far as looking at the test ^^
 
ah :-D
 
6:08 PM
Question for anyone in the room: Is there a way to turn a string "function() { alert('me'); }" into a real closure in JS?
parse, eval, ...not sure what word I'm looking for here
 
@prograhammer eval :D
eval all the things
 
ah, I've never used eval (never encountered the need for it yet)
 
@DanLugg Please tell me your code base is full of eval
 
but in general, I think I've already seen that mistake happen two or three times … people not knowing that you need to dtor external zvals in dtor_obj and not free_obj.
 
@NikiC Surprisingly no, however there are far greater sins.
 
6:10 PM
@bwoebi huh?
Why would you do that?
 
@NikiC would it be "wrong" for me to pass strings representing JS closures from my PHP server side class to be eval'd on the client side? It's a configuration array I have in PHP that I do a json_encode on and send it to the client.
 
because people don't realize the difference between those two, I guess?
 
dtor_obj is for some pretty specific circumstances, you shouldn't be dtoring values in there
In particular, note that calls to dtor_obj are optional
 
@NikiC under which circumstances isn't dtor_obj called?
 
When is use of eval acceptable?
 
6:12 PM
@bwoebi in case of emergency shutdown?
 
@bwoebi Fatal errors for example. Though of course not relevant for leaks ;)
 
@prograhammer eval($_GET['input']); // in this case specifically
 
@NikiC well, sure… but in that case it doesn't matter whether dtor_obj is called or not.
 
@DanLugg you are messing with me, right?
 
@bwoebi I have the feeling that you are recommending something wrong about dtor_obj usage instead of get_gc usage
 
6:13 PM
lol
 
Moving stuff to dtor_obj doesn't actually fix the leak, it essentially only suppresses leak reporting for it...
 
@DanLugg unless you're 3v4l.org j/k
 
@DanLugg I am much disappoint.
 
@NikiC The next thing I do, I'll be sure to use eval for you.
 
@DanLugg it's nice for me to configure stuff server side because it's close to the logic I need to make that decision. But on a couple of occasions, the JS library will accept closures for configuration. So on my PHP side, I'm wondering what best practice is here.
 
6:15 PM
@NikiC well, you need both? get_gc is just important in case gc actually gets run to get memory freed during intermediary gc calls?
 
@DanLugg Thanks :)
@bwoebi You need only get_gc
Unless you actually want to run a destructor or something similar, you don't need dtor_obj (or rather, you just need the default implementation)
 
@NikiC, can you recommend some material for getting the details about get_gc and other object handlers (apart from php-src and lxr.php.net)
 
eval('/* @NikiC said I had to */');
 
@DanLugg Parse error: syntax error ...
 
eval('/* aha! you thought you caught me there */');
 
6:17 PM
@NikiC oh?
 
@DanLugg eval('@NikiC." said I had to";');
To combine eval with your favorite operator!
 
eval('uate this error');
This is fun. Eval humor.
 
@bwoebi (well and obviously free_obj -- but not dtor_obj)
 
@NikiC It should be called the "atom" operator.
[@name => 'Foo'] // no errors here, move along
 
@zaq178miami There is wiki.php.net/internals/engine/objects, but it's so outdated it doesn't even include get_gc (which we have since 5.3...)
 
6:21 PM
@NikiC, yeah, I've read that, there also wiki.php.net/phpng-upgrading about new stuff in php7
 
@DanLugg so I should just probably pass over simple values that I translate on my client side to run the closure I want?
 
@NikiC I still haven't got what dtor_obj is good for then…? To do e.g. zend_call_function() etc.?
 
@NikiC, phpinternalsbook.com is also looks outdated (i heard that is is few years ago on IRC, I guess)
 
#YOLO #IDGAF
 
Thinking about it, that does sort of create an API so I could replace the client-side code with something else that works with my JSON string.
 
6:23 PM
@bwoebi It's good for __destruct() calls and finally calls for generators. That's pretty much it
 
> Caution
The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option than to use this construct, pay special attention not to pass any user provided data into it without properly validating it beforehand.
 
Well okay.
 
If I had closures (eval'd or evil'd) then I wouldn't have something as decoupled on my client-side
 
@NikiC, @bwoebi, I found! phpinternalsbook.com/classes_objects/…, Object store handlers section, it is that source i read about dtor and free mechanism
 
YOLO = eval('window.location.replace($_GET['input']);
 
6:26 PM
Looks like I was misinformed about get_gc...
 
@zaq178miami It was written targeting PHP 5.5
@bwoebi I think you've been misinformed only about dtor_obj, not about get_gc
 
@NikiC though the classes part shouldn't have changed much in PHP 7
 
@bwoebi Not much. Just all signatures slightly different :D
 
@NikiC err, yes.
 
Lol prograham
YOLO 2 = eval('window.location.replace($_GET['password']);
 
6:29 PM
@NikiC, sure, but dtor and free part is relevant for 7, i guess (and hope), isn't it? For me it is import to understand basis correctly.
 
@MenelaosKotsollaris that's probably a more realistic $_GET key
 
@zaq178miami yes. The only major difference between PHP 5 and PHP 7 is that some object mem leaks in PHP 7 were silently ignored in PHP 5.
 
hahahaha I am laughing so hard xD
 
@zaq178miami Yes, that part should still be true
 
look at this: $int = filter_var($str, FILTER_SANITIZE_NUMBER_INT);. Now I want to use $int in the MySQL query. Now I want to know, is it necessarily to I use prepared statement? (because I'm sure $int is containing just numbers)
 
6:32 PM
@NikiC except ...
 
I'm anyway writing classes far too rarely in php-src… not having too much first-hand experience here.
 
RECV%w-%w-%w$a%w-
RECV%w-%w-%w$b%w-
POW%w$a%w$b%wT1%w-
RETURN%wT1%w-%w-%w-
RETURN%w-%w-%w-%w-
 
is it a sailboat?
 
@JoeWatkins looks like a phpt for opcodes… still doing that thing in uopz?
 
@JoeWatkins ah, you separated it into an own ext… thought you'd just create a seven branch for krakjoe/explain?
 
nah the api is crap, it uses way too much memory to be useful
 
@PeeHaa Who needs indentation anyway
 
@PeeHaa I could literally copypaste that into a file on our server, and nobody'd be the wiser.
Also, at least it uses mysqli
 
6:42 PM
@DanLugg Please remind me, why is it you're working there again?
 
The worst code is anyway when people try to be unecessarily smart and exploit weird PHP behavior…
 
@NikiC Food and shelter, primarily.
 
user895378
6:57 PM
@DanLugg I know a sweet ass place in Manhattan where we're trying to pry away good PHP engineers. Lemme know if you're seriously interested.
 
user895378
/me waves
 
lol, funny enough I worked at a sweet ass place in Manhattan before... perhaps I need that again.
 
user895378
you totally do.
 
Much obliged.
Issue is that life goals include not doing the metro thing again; trying to figure out a way to remote with a non-garbage salary.
 
user895378
pffffft
 
user895378
6:58 PM
remote is for old folks
 
a sweet ass-place? giggity
 
I am an old folk ;-)
 
@rdlowrey pfft, daily commute is for old folks.
 
user895378
you people and your ... families ...
 
user895378
I did the not-commute for years. I love my 15 minute walk to work now :)
 
6:59 PM
@NikiC, can you explain a bit about get_gc object handler or point me to some doc about it? lxr.php.net/… is not very verbose
 
@rdlowrey I don't consider a 15 minute walk a commute. A 15 min metro is… but a simple walk… why not?
 
@rdlowrey I would love a 15 minute walk to work, but I don't think there're many unserviced 2 acre lots in the 49th and 5th area.
 
user895378
yeah, and it should really be 10 minutes but I'm a slow walker
 
user895378
Yeah, you wouldn't be able to chop down trees here ...
 
user895378
Or whatever it is you crazy Canadian people do for fun ;)
 
7:01 PM
@rdlowrey xkcd 37.
 
NTTAWWT
 
user895378
@PeeHaa that's exactly what I look like in the morning, actually
 
I know that feel look bruv
 
@rdlowrey inclusive the blood? :-P
 
user895378
7:02 PM
So ... one of our cofounders actually referred to me as a "brogrammer" yesterday lol
 
user895378
It's funny because it's true.
 
I'm not exactly sure how to understand that terminus…
 
@zaq178miami So, get_gc is very simple. The first question is: Do you have a zval[] array that contains all of your additional zvals that are relevant to GC?
In your case, I assume the answer is no: Your zvals are strewn about in separate buckets.
 
A brogrammer (portmanteau of bro and programmer) is a term thought to describe a macho programmer. A brogrammer might self-describe as a sociable programmer. An example sometimes cited is an early Klout hiring advert posted at a Stanford University career fair as "Want to bro down and crush some code? Klout is hiring." The company later described it as a joke and as an unfortunate misstep. The subculture has been criticized by The Atlantic‍ '​s Jordan Weissmann, who blamed the shrinking proportion of women in programming in the last two decades on the "brogrammer effect". Similar articles in the...
> The company later described it as a joke and as an unfortunate misstep
 
@zaq178miami If that's the case, you use an SplObjectStorage-style get_gc implementation: lxr.php.net/xref/PHP_TRUNK/ext/spl/…
Which means, you add a zval *gc_data field and a uint32_t gc_data_num field to your object
in the get_gc handler, you first compute how many zvals you have to register with the gc. (Count number of buckets times some factor for you probably). If that's larger than the current gc_data_num, you reallocate gc_data (and update gc_data_num).
 
7:06 PM
@rdlowrey The evidence for that is kinda evident...
4
 
Then you fill up gc_data with all the zvals you have and put it into the pointer passed to you. Finally, return zend_std_get_properties
For another example that does the same thing, see SplDoublyLinkedList: lxr.php.net/xref/PHP_TRUNK/ext/spl/spl_dllist.c#540
That's basically the standard pattern
 
in that same vein, I just got an email from Zend Rogue Wave about the takeover merger and the first section is entitled "Strong synergies"
 
idiots
 
Our commitment to open source including PHP, Zend Framework, and Eclipse PDT continues to be very strong. :p
 
@Machavity fix the lighting… Anthony looks so unnatural there...
 
7:13 PM
@bwoebi Wish I could take credit, but my Photoshop skills are very, very low
 
@Machavity well, first time I see the imaging with Anthonys face.
 
@bwoebi There's only a couple of pics of Anthony in the wild and this one is probably the best
 
ah
 
@NikiC, so basically zend_std_get_properties(obj) is always returned on gc call, right?
 
I just have a quick question about the php development server. Is the server supposed to show newlines from php echo calls?
 
7:19 PM
@zaq178miami for custom handlers, yes
 
user895378
@Machavity who needs the wild?
 
user895378
I'll just go secret agent with my phone.
 
@NikiC, what if no gc handler set? Just curious.
 
@rdlowrey Aren't all you people going wild over there though?
 
@zaq178miami there is a default handler
In most cases it will put the properties table into the pointer and return NULL
If there's dynamic properties, it will return zend_std_get_properties as well
 
user895378
7:21 PM
@PeeHaa If by "going wild" you mean "drinking, playing shuffleboard and fighting nerf gun wars at the office" ... then yes.
 
too_many_args(
   $this->id
  ,'some constant string'
  , 123
);
Yeah ... no.
 
@rdlowrey shuffleboard. Isn't that what old folks do when they are on a cruise?
 
user895378
Okay well there's ping-pong and foosball for the young whippersnappers if you prefer Mr. Fancypants.
 
:P
 
what, no air hockey?
 
7:25 PM
@NikiC one thing I don't understand is why he wants to add trailing ',' just on arglists. If it's not going to be everywhere there are lists I wouldn't bother to make the change.
 
@rdlowrey Why go secret agent? Just snap a pic
 
@marcio Which other lists are you thinking of?
 
@NikiC Eeeeeeew I have seen people do that
And no. They are all dead now
 
@PeeHaa I've seen it as well...
 
@NikiC class property and constant lists, also somebody here complained once or twice about use lists (including the grouped use).
I don't buy the 'consistency' with arrays if it's not a global change.
 
7:28 PM
ow, a new tool by google. a calculator
 
@marcio There is strong similarity between an array and a variadic function
Especially if you consider something like
 
its old
 
array(
    1,
    2,
    3,
);
// vs
new Vector(
    1,
    2,
    3//,
);
@marcio It might make sense for group use. However I wouldn't like to have a trailing common for lists that are semicolon terminated
 
If you really need the trailing comma, why don't you just:
 
I mean ... const FOO = 1, BAR = 2,; wtf
 
7:30 PM
func(...[
    1,
    2,
    3,
]);
2
 
Guys say I have this URL : myURL.com?x=1&y=1&x=3&y=4. How can I story the x's and the y's to an array? I am sure there is a way of filter_input with some additional parameters maybe?
 
@MenelaosKotsollaris I certainly hope that would overwrite
 
@bwoebi Yes ... to improve ergonomics of variadics, simply wrap it into an unpacked array. great
 
@NikiC well, if you collapse arrays to one-liners, like [1,2,3,] it looks awkward too.
 
@PeeHaa What do you mean?
 
7:33 PM
WTH it appends httpbin.org/get?x=1&x=2 TIL
 
Can't I somehow store the x's with a simple filter_input(INPUT_GET, 'x') or would I need to parse my URL entirely?
 
What does filter_input have to do with storing something?
 
does someone know how and when PHP detects that value is not freed?
 
@NikiC I became quite addicted to class prop/const list over the last 3 months, a trailing ',' would be handy gist.github.com/marcioAlmada/75f8f1d47da5dcac2e57
the prop list kinda coerces the team to group stuff by visibility, so it became a valuable coding style.
 
looks nice too
 
@zaq178miami Search for "leak" in zend_alloc.c
 
@PeeHaa I need to get the variables from the URL. So myURL.com?x=1&y=1&x=3&y=4 would result to a $x and $y array. As you said $x = filter_input(INPUT_GET, 'x'); overwrites the previous variable.
 
@bwoebi no way :P
 
@MenelaosKotsollaris It does that already?
Why are you (trying to) use filter_input?
 
@Machavity thanks, but already seen that
@NikiC, i remember someone told me that values free'ing order on shutdown is not guaranteed to have specific order, is it still valid for PHP7
 
7:42 PM
@zaq178miami yes
 
I generally use this for getting unique IDs ; Thought it would somehow work for this case too
 
My problem is how to actually Get the values from the URL. myURL.com?x=1&x=3. How can I get my x's (possibly to an array $x[0]=1 and $x[1]=3)
 
@MenelaosKotsollaris Doesn't $_GET['x'] give you what you want?
 
Hello eveybody, I really loved DigitalOcean's API Documentation page design. developers.digitalocean.com/documentation/v2 How can I generate with same style documentations? Is that a theme?
 
7:50 PM
It seems that it overrides the previous variable, so it doesn't. Maybe I am missing something here? This URL: muURL?x=1&x=4 with this code: $x = $_GET['x'] ; echo $x[0]; echo $x[1]; returns 4 and ` Uninitialized string offset:`
 
@musa Right click. View page source. Plagiarize learn from the experts and apply in your own projects.
 
@MenelaosKotsollaris foreach(explode('&', $_SERVER['QUERY_STRING']) as $elem) { parse_str($elem, $var); list($key, $value) = each($var); echo "$key == $value\n"; }
 
@PeeHaa AFAIK there is no formal specification on how to parse application/x-www-form-urlencoded … all it specifies is that it's an urlencoded list of key-value paris joined by equal signs and separated on ampersands. Whether it is overwritten, parsed as array or multiple entries form an array is part of the implementation side.
 
@bwoebi TIL even more
 
Oh so there is no easy way to get same IDs .. @Sara will check your solution out thanks!
 
7:53 PM
By the way, @Levi, if you're not going to go forward with nullable types, I'd be happy to do that...
 
@Andrea He'll probably say that he wants to make it part of union types instead...
 
@MenelaosKotsollaris You could always change the querystring to x[]=1&x[]=2 I assume
 
@Ghedipunk I was looking for something like that apidocjs.com
 
@PeeHaa I'd be surprised when PHP would create an array for duplicates in query string. we have the name[] syntax for that.
 
@NikiC which I don't like too much :p
 
7:54 PM
Funny story: [ACertainCompany] used to (still does?) have a patch to PHP that turns x=1&x=2 into x=array(1,2) but leaves a single x as just a normal value.
 
@Sara Facebook? :p
 
@Andrea Nope. For one thing, we don't use PHP
 
@musa So... then use it. Why are you asking PHP developers about front end stuff?
 
I need to be a bit careful when it comes to getting variables from URL so I will dig in to it.. thank you
 
@Sara Hack is only slightly not-PHP
 
7:54 PM
@Andrea Still though, a different certain company
 
hmm
Zend?
 
I couldn't possibly comment.
 
hehe
 
@Andrea nullable types had too much ambiguities when interacting with union types.
 
^ this.
 
7:55 PM
@marcio union types have too many ambiguities when interacting with PHP as it currently exists
I know I sound like a broke record, but weak typing is the killer
to get it to work you need to add a complex new set of rules
there isn't even a precedent for how they would work, since internal functions don't do that
 
I'd first like to see union types and we can fall back to nullables if these fail.
 
I also don't like union types because they allow more freedom than I think they should
 
@Andrea excuse me, but why union types would be antagonist of weak typing?
 
@marcio how do you decide which type to convert to?
 
@marcio input: string … expected: int|bool … what do you cast to?
 
7:58 PM
the first valid one?
 
both are valid, so int
but, consider
a string is always a valid boolean
 
Abe
@Andrea why care? one or the other will be fine
 
@Abe doesn't mean the result would be sensible
weak typing, for all its absurdities, does make some sort of sense
coupled with union types you'd get consistent but unintuitive results
 

« first day (1825 days earlier)      last day (3133 days later) »