« first day (1529 days earlier)      last day (3409 days later) » 

12:00 AM
did I do that?
that was an accident
 
@ircmaxell Yes, you removed that thing from zend_lookup_class_ex.
 
moved it to zend_autoload_call
 
Good idea :)
I just put it in a constant, but putting it in the autoload stuff is, in retrospect, a better idea.
 
OK, I'm off for the night
I just pushed the latest
if you want to implement the VM checks, feel free to do that :-)
 
12:13 AM
@AndreaFaulds looks like rust is gonna do overflow checks in debug builds
and you got to use a WrappedInt type if you want overflow behavior
you win :P
 
YESSSSS
@ircmaxell May do :)
 
@NikiC with hashtables storing pointers
how do you handle the destructor?
nevermind, I think
 
12:37 AM
off for the night, were you? :p
Anyway, with the magic of git checkout tree-ish path I may have got function autoloading working.
 
@ircmaxell You use Z_PTR_P in the destructor
 
yeah, got that
now I have one mysterious leak left
 
where does it leak from?
 
zend_hash.c(273)
 
12:44 AM
Memory leaks?
:(
 
fixed :-D
forgot to destroy the hash tables
 
^^
 
is it safe to destroy a statically allocated hashtable?
 
yes
zend_hash_destroy only cleans up stuff the hashtable itself allocated
If the HashTable struct was allocated too, that would be a separate free
 
12:48 AM
@ircmaxell ps zend_string_copy
 
where?
 
copy = addref+return
 
ah,. nevermind
 
just a more compact notation :)
 
well, and proper API usage
 
12:49 AM
@ircmaxell Merry Christmas :)
 
@ircmaxell github.com/ircmaxell/php-src/compare/… This looks very fishy
Especially the fixed length there
 
$ sapi/cli/php -r 'php\autoload_register(function ($name) { echo "autoloading $name", PHP_EOL; include "$name.php"; }, php\AUTOLOAD_FUNCTION); var_dump(function_exists('test', false));'
bool(false)

$ sapi/cli/php -r 'php\autoload_register(function ($name) { echo "autoloading $name", PHP_EOL; include "$name.php"; }, php\AUTOLOAD_FUNCTION); var_dump(function_exists('test', true));'
autoloading test
bool(true)
 
one problem there, don't call zend_lookup_function directly from the executor. Use ZEND_LOOKUP_FUNCTION_BY_NAME()
 
as it short-circuits
@NikiC it is
 
12:51 AM
@ircmaxell If you aren't too much into the unsigned, you can use zend_long_to_str
 
@ircmaxell Will do.
 
it's a dirty-arse hack for now, to deterministically extract a string key from the ... wow
OK
@AndreaFaulds ++
 
@ircmaxell Can't find such a function on lxr...
 
@ircmaxell We usually use it as an int key instead - as with 7 we're guaranteed to have enough size
 
12:52 AM
Ah, people who don't bother doing cursory research are now submitting dumb SO questions directly to lolphp :)
 
@ircmaxell but honestly, do we really need the key magic there?
 
@ircmaxell Ah, I see. Will update. So is that just for zend_vm_def?
 
I'm 100% open to suggestions
@AndreaFaulds well, it's for anywhere you expect the function to exist already
 
I'd rather just iterate on unregister. It's not like unregister perf is of any relevance
 
as it bypasses a function call, lower, etc
 
12:54 AM
Alright.
 
any shortcuts to append/prepend on a hashtable?
zend_hash_next_index_ptr
 
@ircmaxell append is zend_hash_next_index_insert(_ptr)
prepend doesn't exist
you're already doing that one right with the memmove
 
yeah, got it
 
btw I don't think we have structures that have both append and prepend in an efficient ways
all our stacks are array based, so those are append only
actually something I never looked at, how you'd implement something like that nicely
the hash API has become quite bloated ... the header file is close to 800 lines ^^
 
1:15 AM
fixed and pushed
int zend_autoload_register(zend_autoload_func* func, zend_bool prepend)
{

    if (zend_hash_next_index_insert_ptr(&EG(autoload.functions), func) == NULL) {
        return FAILURE;
    }

    if (prepend) {
        HT_MOVE_TAIL_TO_HEAD(&EG(autoload.functions));
    }
    return SUCCESS;
}
^^ really became simple :-)
 
OK, using ZEND_LOOKUP_FUNCTION_BY_NAME now
 
nice :-)
@AndreaFaulds github.com/TazeTSchnitzel/php-src/compare/… <-- on purpose?
 
@ircmaxell No
Trying to fix :(
 
:-)
 
@ircmaxell There's ZEND_HASH_FOREACH_NUM_KEY_PTR as well :)
 
1:19 AM
aaaaa
 
missed that
 
And the two zvals here: github.com/ircmaxell/php-src/compare/… should be pointers
night
 
fixed & pushed
thanks!
heading home now
later
 
Now for my second task of today: cleaning up Dmitry's mess...
@LeviMorrison I see you. How're things?
 
1:35 AM
^^ Good but busy.
 
Ah
I was expecting that :p
 
I got to play with Rust a bit today.
 
That was fun.
@NikiC If you truly care about the fast prepend then linked list is your friend. However, iteration is slower and you are likely going to do a malloc on each prepend/append operation (not true for arrays where you can alloc a series)
I suspect that optimizing for prepend here would not be good overall.
How often do you prepend or append versus actually calling the autoloader? I suspect you call it more than you add new autoloaders.
^ That's based on the premise that autoloaders generally load more than one thing.
 
1:56 AM
Expected behavior if you add the same autoloader twice? Ignore second? Register second? Error?
 
2:15 AM
@ircmaxell Succeed if for differing types. Error otherwise.
Since, really, there's nothing wrong with doing a call for FUNCTION and a call for CLASS vs doing a single call for both, no?
They are separate lists.
 
Same list
 
Oh.
well basically, if (bitmask_existing & bitmask_new) { bang! }
If that makes any sense :)
You're home now, presumably?
 
Yup
 
Ah. Please consider merging my pull request ;)
Or reviewing it, at least.
 
looking now
@AndreaFaulds we shouldn't try to autoload functions when looking up methods: github.com/ircmaxell/php-src/pull/11/… :-P
 
2:22 AM
@ircmaxell zend_call_method works for non-methods too, somehow
Note the !obj_ce
 
whoops, good call
 
At least, I think it does. It seems to, I think spl autoloading called it somewhere actually
 
it does
I'm using that
 
Aha :)
 
merged
going to start refactoring spl soon
 
2:24 AM
Thanks :D
Now all that time I wasted wasn't wasted
 
well, we don't know if it'll be accepted :-P
 
Ooh, "merge pull request", never seen that before. Is that what the GitHub merge button does?
 
yup
 
Ooh. With constant autoloading, my escapes package could be even more efficient.
 
lol
 
2:31 AM
If you missed it earlier: github.com/TazeTSchnitzel/escapes ☚ an obvious beneficiary of constant autoloading
 
add that to the RFC
as justification
 
hahaha
@ircmaxell I think it might have the opposite effect...
 
;-)
 
OH GOD NO
@ircmaxell you could use this to make barewords always legal
...
 
yup
which is awesome
 
2:33 AM
:p
 
ever doing that is crazy
 
making a namespace for bareword escaping would be pretty handy actually
 
but the ability to is awesome
 
Like, say I make \bareword and anything in it is just the literal bareword
All the possibilities
 
so use const bareword\foo?
 
2:34 AM
yeah
or use bareword as b; $x = b\barewords_rock;
 
well, at that point...
 
It's like having :symbols except a horrible hack
 
that's not why those exist
those exist because ruby's string implementation sucks
 
I realise that
So many possibilities, @ircmaxell. You're going to regret this!
use const path\foo\bar\baz\boo as boop; // ['foo', 'bar', 'baz', 'boo']
 
:-)
 
2:38 AM
Add support for a new kind of numeric literal!
 
/me ragequits
 
nooooooooooooooo
 
:-P
wait, hang on, go back
new kind of numeric literal
holy crap, I never thought of that
 
T1201111012 or something
@ircmaxell The possibilities are limitless!
 
lol
@AndreaFaulds there's a bug in your implementation
<?php

namespace Foo;

\php\autoload_register(function($name) {
    var_dump($name, func_get_args());
});

foo();
Fatal error: Cannot call overloaded function for non-object in
in var_dump()
 
2:43 AM
Oh no, not that error again... something slipped through
it's that variadics issue
hmm
 
is it?
 
it was before
but I looked through my diff again and I'd fixed all that
so I'm not sure what's broken it
I'd look at that on my machine but I'm in the middle of a bigints merge
Try merging in master...
 
kk
 
3:01 AM
Maybe I messed up zend_call_method
if (!obj_ce && !zend_lookup_function(Z_STR(fci.function_name))) {
hmm
should probably be if (!(!obj_ce && zend_lookup_function(Z_STR(fci.function_name)))) {
 
well, don't you want the result of zend_lookup_function?
 
not in this case, no
I'm just triggering an autoload
 
kk
 
Whether or not it's the bug in question, that line probably is buggy and you should probably replace it with the second one
 
will do once I merge master
 
3:03 AM
ok
 
wait, why don't you want to store the fci?
replaced it with if (obj_ce != NULL || NULL == (fcic.function_handler = zend_lookup_function(Z_STR(fci.function_name)))) {
 
because it's already done the lookup
Oh, right...
oops
:p
 
ahh, I see the problem
 
if it doesn't save the new function, that check's rather pointless
my bad
 
github.com/ircmaxell/php-src/compare/… <-- that check shouldn't be there
because of fallback behavior
 
3:15 AM
Why shouldn't it?
 
namespace foo {
    bar();
}

// should only autoload global bar() function
 
Ahh
I get you
 
yup
otherwise every strlen() call inside of a namespace will trigger the autoloader
but use function foo\bar or foo\bar would always trigger
man, this laptop is SLOW to compile
make clean && make takes about 5 minutes
or more
 
So the first one shouldn't autoload, the second should?
 
make -j8 =D
 
3:18 AM
@AndreaFaulds ?
I'm rebuilding testing the fix before committing
nope, didn't fix it
 
Do any of my code samples from earlier work?
 
hmmm, weird...
gdb says zend_lookup_function_ex isnt' called at all
which I know to be not true
no...
hmmm
 
:-/
OK, well
 
I give up
I can't work on this machine
and WTF do we generate headers like this?
 
3:32 AM
why not .c files so I don't need to rebuild the entire freaking thing every change
 
@ircmaxell the zend vm pushes up against the limits of the C prepro-
actually, no, well
why the hell do we generate a VM?
 
@AndreaFaulds I don't know actually...
 
We could do this with macros.
and inlined functions
 
prior
 
@ircmaxell It's horrid for debugging, too
 
3:34 AM
it's in the fcall handler
tell me about it
I don't mind generating it
I mind generating it as a bloody header file
 
@ircmaxell I wish we could make it be in the Makefile
So just make would update it
Like with the language scanner
Heck, if we can do it for the scanner/parser/etc., why not the VM?
It wouldn't stop normal people building w/o PHP
Because we'd have the pre-generated one in the repo
 
go for it
 
3:52 AM
found the issue :-)
ZEND_LOOKUP_FUNCTION_BY_NAME has a bug in it
fixed :-D
pro-tip: lookup return values when you cast, as casts will mask errors ;-D
 
yay
Finally merged master into bigints branch
Now to fix right shifts
 
:-)
how do I run a specific test again with make test?
I know how to do it with run-tests
 
Good question. Look in Zend's Makefile
/* LibTomMath's mp_div_2d does a logical right shift
 * in order to correctly mimick a two's-complement arithmetic right-shift,
 * we just need to do a one's complement first */
if (SIGN(&num->mp) == MP_NEG) {
    zend_bigint_ones_complement(out, num);
    CHECK_ERROR(mp_div_2d(&out->mp, shift, &out->mp, NULL));
    zend_bigint_ones_complement(out, out);
/* No mimickry needed for positive op1 :) */
} else {
    CHECK_ERROR(mp_div_2d(&num->mp, shift, &out->mp, NULL));
}
:D
bigints will add no external dependencies, libre software FTW
 
4:23 AM
Ooh.
Correct me if I'm wrong, but eval("const _FOO = $bar; return _FOO;"); is probably safe with minimal validation. We can call it PHP Object Notation :p
 
"safe"?
hashdos
thanks to @bwoebi :-P
 
4:47 AM
Btw @NikiC, nice blog post
6
 
 
1 hour later…
6:13 AM
moin
 
can I ask ?
 
7:04 AM
@NikiC your blog post is first on HN :D
 
we <3 @NikiC ... I just worry that one day we'll loose him to more interesting things ... that'll be a sad day ...
 
can I ask your help php/MySQL people in my thread stackoverflow.com/questions/27615693/updating-column-amount
I'm working in Multi-level Marketing,and I'm getting trouble in updating amount
 
7:24 AM
@ashTon that's exactly what the world needs, another pyramid scheme...
 
dealing with hierarchical data in relational databases is not fun
 
but is there a solution to my problem ?
 
You're not running up against the laws of physics or anything, so yeah - I'd say there's a solution. That doesn't mean I'm touching it with a ten-foot pole.
 
@ashTon yes, but I am not going to help you exploit poor people like all those other MLMs out there...
 
posted on December 23, 2014 by kbironneau

/* by Bastien */

 
7:38 AM
@Patrick, what do you mean poor people like all those other MLMs out there?
 
you missed the magic word "exploit" ...
 
okay,I apologize I could not get what exactly the sentence mean.
 
1
Q: Parse CodeIgniter cookie with Node.js

s.m.I'm trying to parse a CodeIgniter cookie with node.js. I'm using this code to get all the cookies: function parse_cookies(_cookies) { var cookies = {}; _cookies && _cookies.split(';').forEach(function( cookie ) { var parts = cookie.split('='); cookies[ parts[ 0 ].trim() ] = ( pa...

 
@s.m. you might be looking for the javascript room
 
PHP too
Trying to parse a PHP cookie
But yea probably more javascript
 
7:48 AM
@s.m. return (array) unserialize(substr($ciSession, 0, strlen($ciSession)-32));
 
@Patrick is it really that easy?
 
@s.m. yes. Just translate it to JS. If you want to set a new CI session it's a little more complication as you need the config value to create the hash
 
@Patrick why are you using substr?
 
@crypticツ pretty sure I copied that directly from the CI code...
 
@Patrick i just noticed you posted php code... i'm trying to parse the cookie with node.js
 
7:52 AM
@s.m. oh sorry, I thought we are in the php room. Must be my fault
But seriously, just translate it to js... This is not a code writing service
 
I posted in php room because it's a codeigniter cookie
 
@s.m. That it was originally create with code that happens to be written in PHP is irrelevant. You're trying to parse it with javascript.
This isn't a PHP problem.
 
@PaulCrovella ok i'll go to js room thanks
@Patrick code writing service?
 
@s.m. as in try something first, like make an attempt before asking people to write something for you.
 
7:56 AM
@crypticツ how are you so sure I haven't attempted? been on it for hours
 
@crypticツ interesting...didn't know it works like that
@s.m. so why did you not post the code from your attempts?
 
@crypticツ @Patrick when did i say i want someone to write something for me?? did you guys even read my question?
 
@s.m. I gave you an answer, you complained that I was not in JS
 
@Patrick why would i post all my failed attempts? that won't help anybody...
@Patrick complained?
@Patrick "i just noticed you posted php code... i'm trying to parse the cookie with node.js" - how is that complaining?
 
8:01 AM
@crypticツ thanks i'll check that out. I tried like 3 modules for cookie parsing but they didn't help
 
@s.m. it's not cookie parsing. The value is serialized by PHP, cookies are not meant to be serialized so cookie packages won't support it. CodeIgniter sucks so it serializes the values.
 
8:14 AM
good mornings
 
mornin
 
8:30 AM
good morning
 
8:41 AM
I am using trying ffmpeg first time
i download files from web
the example shows about the file libx-264 blah blah
but when I download this I didn't the file 'libx-264'
what should I do
 
@crypticツ Really? lol
 
zan
Hi everyone
 
Morning
 
Mornignigngingigng
@Sandesh updatedb && locate libx
 
@PeeHaa Mornigga
 
8:52 AM
^lol
 
@crypticツ i tried unserializing it with that module you linked but it's not working, when i do console.log on the cookie it's not in that serialized format
 
@s.m. ...
 
@SecondRikudo what
 
mornings
 
@SecondRikudo I have no words either =oP
 
8:59 AM
@crypticツ lol he just said that cause i wasnt responding to him in the js chat
 

« first day (1529 days earlier)      last day (3409 days later) »