fix bug #72254 - get_object_vars with numerical properties#2091
Closed
schlndh wants to merge 1 commit intophp:PHP-7.0from
Closed
fix bug #72254 - get_object_vars with numerical properties#2091schlndh wants to merge 1 commit intophp:PHP-7.0from
schlndh wants to merge 1 commit intophp:PHP-7.0from
Conversation
|
Comment on behalf of cmb at php.net: This issue has already been fixed by PR #2142, which has been already merged. Also the respective bug report has been closed, so I'm closing this PR. Thanks for the PR, anyway! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_exfunction 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_newfunctions 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_exfunction 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.