Repository navigation
Conversation
|
This patch basically changes the signature for to and does the necessary changes in all extensions (hopefully I didn't miss any ^^). The Things still to do: Figure out what to do with non-string/int keys when converting to array (iterator_to_array / CacheIterator). |
This commit adds a new ZEND_API function array_set_zval_key, that sets
the key in the zval with the same semantics and errors as PHP would
normally do. This new function is used to implement iterator_to_array
and CachingIterator for non-scalar keys. In particular
iterator_to_array() should now behave exactly the same as doing a
manual loop with array insertion:
foreach ($it as $k => $v) {
$array[$k] = $v;
}
|
Awesome work! 👍 |
|
good 发自我的小米手机 datibbaw notifications@github.com编写:
|
|
Which tests can/should I run to test the patch? |
|
@weltling Zend/tests and ext/spl/tests should cover the main thing. Though this change is mostly changing the use of the API in extensions all over the place, so "all of them" might be better :) |
|
@nikic Ok, thought that :) I was just wondering there are no tests for the special case mentioned in the RFC. Performed them altogether now, looks good. |
There was a problem hiding this comment.
currently, zend_hash.c didn't depend on zval struct, will it better move the function to zend_API ?
|
Merged in fcc6611. |
This is just a preliminary patch for the https://wiki.php.net/rfc/foreach-non-scalar-keys RFC.