rfc:convert_numeric_keys_in_object_array_casts
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
rfc:convert_numeric_keys_in_object_array_casts [2016/11/14 17:41] – vote closed ajf | rfc:convert_numeric_keys_in_object_array_casts [2017/11/30 14:49] – fixup ajf | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2016-10-21 | * Date: 2016-10-21 | ||
* Author: Andrea Faulds, ajf@ajf.me | * Author: Andrea Faulds, ajf@ajf.me | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 10: | Line 10: | ||
The PHP language has two core data types which are collections of key/value pairs. | The PHP language has two core data types which are collections of key/value pairs. | ||
- | The first of these, the //array//, is an ordered map of integer or string keys to arbitrary values. There is no overlap between integer and string keys in arrays; if a string fits the format ''/ | + | The first of these, the //array//, is an ordered map of integer or string keys to arbitrary values. There is no overlap between integer and string keys in arrays; if a string fits the format ''/ |
The second of these, the //object//, is an ordered map of string property names to arbitrary values. Integer property names are not permitted, these are converted to string property names. Objects have some other attributes, but they do not concern us here. | The second of these, the //object//, is an ordered map of string property names to arbitrary values. Integer property names are not permitted, these are converted to string property names. Objects have some other attributes, but they do not concern us here. | ||
Line 24: | Line 24: | ||
Various edge cases in the Zend Engine exist where array HashTables can contain numeric string keys, and object HashTables can contain integer keys. In such cases, these keys are inaccessible from PHP code, because the code handling arrays will never look for numeric string keys in the HashTable (as arrays map those to integer keys), and the code handling objects will never look for integer keys in the HashTable (as objects map those to string keys). | Various edge cases in the Zend Engine exist where array HashTables can contain numeric string keys, and object HashTables can contain integer keys. In such cases, these keys are inaccessible from PHP code, because the code handling arrays will never look for numeric string keys in the HashTable (as arrays map those to integer keys), and the code handling objects will never look for integer keys in the HashTable (as objects map those to string keys). | ||
- | This RFC focuses on a specific edge case, that of object-to-array casts and array-to-object casts. Currently, when using < | + | This RFC focuses on a specific edge case, that of object-to-array casts and array-to-object casts. Currently, when using < |
===== Proposal ===== | ===== Proposal ===== | ||
Line 30: | Line 30: | ||
==== High-level ==== | ==== High-level ==== | ||
- | This RFC proposes to fix this issue for object-to-array casts and array-to-object casts, both for the casting operators and for < | + | This RFC proposes to fix this issue for object-to-array casts and array-to-object casts, both for the casting operators and for < |
==== Internals ==== | ==== Internals ==== | ||
Line 96: | Line 96: | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | The pull request is here: https:// | + | The pull request |
+ | |||
+ | There is no language specification patch, because none is required. The language specification did not specify or comment on this bug. | ||
===== Implementation ===== | ===== Implementation ===== | ||
+ | |||
+ | This is implemented in master, which will become PHP 7.2. The commit is: https:// | ||
+ | |||
After the project is implemented, | After the project is implemented, | ||
- | - the version(s) it was merged to | ||
- | - a link to the git commit(s) | ||
- a link to the PHP manual entry for the feature | - a link to the PHP manual entry for the feature | ||
rfc/convert_numeric_keys_in_object_array_casts.txt · Last modified: 2017/11/30 14:50 by ajf