-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Disallow indirect modification on readonly properties within __clone() #15012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disallow indirect modification on readonly properties within __clone() #15012
Conversation
ad503d0
to
14be48b
Compare
It looks like this reverts the behavior introduced by https://wiki.php.net/rfc/readonly_amendments (that was voted and accepted). I have no idea about the desired behavior, but if something was introduced by mistake, please consider refactoring the whole https://wiki.php.net/rfc/readonly_amendments patch. cc: @kocsismate |
Thanks for finding this inconsistency with #7942.
It only reverts some part of it where the property is modified indirectly. |
624c061
to
e6120aa
Compare
e6120aa
to
ba5e67e
Compare
I didn't realize this required JIT changes. @dstogov Can you please check if they look correct to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JIT part seems to reflect the VM changes.
I can't verify this in all details but I think this may be merged.
Indirect modification isn't allowed in __construct() because it allows references to leak, so it doesn't make much sense to allow it in __clone().
ba5e67e
to
2cf7993
Compare
@dstogov Thank you for the review! |
Indirect modification isn't allowed in __construct() because it allows references to leak, so it doesn't make much sense to allow it in __clone().