Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
togov; Xinchen Hui; Nikita Popov; Joe Watkins; Bob Weinand; Andrea Faulds Cc: PHP Internals Subject: Re: [PHP-DEV] Exploit fully packed array/hash property Hi Dmitry, On second thought, I might have dismissed your HASH_FLAG_*_KEYS idea prematurely. Of course we will have to set/unset the flag in par

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Benjamin Coutu
loops. This would not entail any overhead on write. What do you think? Cheers, Benjamin == Original == From: Dmitry Stogov To: Benjamin Coutu , Xinchen Hui , Nikita Popov , Joe Watkins , "Bob Weinand" , Andrea Faulds Date: Wed, 19 Oct 2016 18:02:53 +0200 Subject:

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
ks. Dmitry. From: Benjamin Coutu Sent: Wednesday, October 19, 2016 6:51:00 PM To: Dmitry Stogov; Xinchen Hui; Nikita Popov; Joe Watkins; Bob Weinand; Andrea Faulds Cc: PHP Internals Subject: Re: [PHP-DEV] Exploit fully packed array/hash property I would suggest we stickt to my original pr

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
t: Wednesday, October 19, 2016 5:31:01 PM To: Dmitry Stogov; Xinchen Hui; Nikita Popov; Joe Watkins Cc: PHP Internals Subject: Re: [PHP-DEV] Exploit fully packed array/hash property Hi Dmitry, there is a typo in line 78 of your patch (https://gist.github.com/dstogov/429fcc2ba051fdcf774a310c5d6d

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
I may add comments for HT_IS_FULLY_PACKED() or may be use a better name HT_IS_WITHOUT_HOLES() From: Andrea Faulds Sent: Wednesday, October 19, 2016 4:25:31 PM To: internals@lists.php.net Subject: Re: [PHP-DEV] Exploit fully packed array/hash property Hi Dmitry

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
o be self-containing changes to particular functions implementation. Thanks. Dmitry. From: Dmitry Stogov mailto:dmi...@zend.com>> Sent: Wednesday, October 19, 2016 2:20:12 PM To: Benjamin Coutu; Xinchen Hui; Nikita Popov; Joe Watkins Cc: PHP Internals Subject: Re:

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Joe Watkins
s to particular > functions implementation. > > > Thanks. Dmitry. > -- > *From:* Dmitry Stogov > *Sent:* Wednesday, October 19, 2016 2:20:12 PM > *To:* Benjamin Coutu; Xinchen Hui; Nikita Popov; Joe Watkins > *Cc:* PHP Internals > *Subject:*

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Andrea Faulds
Hi again, Andrea Faulds wrote: Second, do you know if any other PHP functions do a similar check to JSON's php_json_determine_array_type for whether an array is free of string keys and consecutively indexed? I wonder if that could be abtracted into a zend_hash.c function. It seems Dmitry was w

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Andrea Faulds
Hi Dmitry, Dmitry Stogov wrote: The main API/BC changes implementation: https://gist.github.com/dstogov/429fcc2ba051fdcf774a310c5d6db00d All tests passed. Performance is not affected (+1 CPU instruction on each *new* element insertion) If it's OK and allowed, after committing this, I'll add

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Andrea Faulds
Hi Benjamin, These are interesting optimisations. I definitely see the usefulness of detecting packed arrays and short-circuiting: I've done that in my patch to fix object/array casting, in order to avoid wasting time checking for the existence of non-string keys, even if (object)[1, 2, 3] is

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
ns Cc: PHP Internals Subject: Re: [PHP-DEV] Exploit fully packed array/hash property Hi Benjamin, I think this is great idea! Let me check that can we get from this, and if we may add this into PHP-7.1 (it may be to late). Thanks. Dmitry. From: Benjamin C

Re: [PHP-DEV] Exploit fully packed array/hash property

2016-10-19 Thread Dmitry Stogov
Hi Benjamin, I think this is great idea! Let me check that can we get from this, and if we may add this into PHP-7.1 (it may be to late). Thanks. Dmitry. From: Benjamin Coutu Sent: Wednesday, October 19, 2016 1:45:00 PM To: Xinchen Hui; Dmitry Stogov; Nikita