Uh oh!
There was an error while loading. Please reload this page.
Don't overload ArrayObject get_properties - #3574
Conversation
Previously this was only possible by changing get_properties, which also impacts other behaviors. This change required an adjustment in compare_function, which compares objects and non-objects by casting the object to the type of the non-object. However, as an exception, arrays are treated as null.
Instead explicitly overload the (array) cast.
fc8b5f5 to
53ba6bcComparenikic
commented
Oct 4, 2018
Overall I'm not really happy with this change, as it has potential impact on too many places. I think a better solution might be to introduce a |
dstogov
commented
Oct 4, 2018
This is definitely not a simple bug fix :( |
dstogov
commented
Oct 4, 2018
@nikic SPL is over-designed, and provides more functionality that actually can do :( If you decide to proceed with get_properties_for(), it may make sense to just change prototype of get_properties(). Object handlers are going to be broken by typed properties, anyway. |
nikic
commented
Oct 10, 2018
Closing in favor of #3579, which has landed. |
Change to fix#3573 (comment).
The first commit lays groundwork to allow proper overloading of
(array)casts. The second commit explicitly overloads(array)forArrayObjectand removes theget_propertiesoverload.The BC breaks are noted in UPGRADING. I think that
array_key_exists()is the only problematic one. However, as we already plan to deprecate array_key_exists with objects. As this will make the operation generate a warning (rather than silently change behavior) I'm not so concerned.