Repository navigation
Conversation
|
I don't think this is the right fix. IMHO, these properties should have been declared |
Right, so we cannot do it exactly like that because of inheritance. PHP is sometimes so stupid.
|
The last time I looked into this (I'm not sure it's exactly this), changing the fake-readonly behaviour broke BetterReflection as it actually relies on being able to hack around these protections. |
I saw that. But they are relying on an undefined-behaviour hack, and they should change their approach. It's only applicable to |
|
Definitely master-only, may be good to ping them as well. |
d672537 to
978e2b1
Compare
|
Makes sense, I rebased this onto master and added the note to UPGRADING. The PR still leaves |
Plain assignment to
$name/$classon reflection objects already throws fromwrite_property, but compound assignment,++/--and&$r->namego throughget_property_ptr_ptr, which reflection didn't override, so they wrote to the property slot directly. This adds aget_property_ptr_ptrhandler that throws the same "Cannot set read-only property" exception for those two properties.read_propertyalso no longer caches the offset of these two properties. Otherwise$fn($r->class)called first by value and then by reference from the same call site reuses the cached offset and never reachesget_property_ptr_ptr.Fixes #24147