fix bug #72254 - get_object_vars with numerical properties #2091
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem is that PHP 5.6 uses
add_assoc_zval_ex
function to add properties to returned array, which handles numerical keys separately, whereas PHP 7.0 either returns the properties hashtable directly (in which case I guess that numerical keys are not handled separately) or adds properties to returned array usingzend_hash_str_add_new
/zend_has_add_new
functions which again don't handle numerical keys separately.I suspect that the reason why numerical keys are not accessible using the PHP 7 code is that when accessing an array, numerical keys are always handled separately and because they are stored as ordinary string keys, they cannot be accessed.
I therefore switched back to
add_assoc_zval_ex
function and removed the code that just returned properties hashtable, since it can contain numerical keys stored as strings and would need to be duplicated anyway.