-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix #79487: ::getStaticProperties() ignores property modifications #5429
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
Conversation
When retrieving the static class properties via reflection, we have to cater to possible modifications.
As suggested by Nikita.
|
Thanks @nikic! I'll have a closer look at this ASAP. |
|
Ping |
|
Sorry for the delay. |
|
Pong :) |
<?php
class A {
public static $a = 'A old';
}
class B extends A {
public static $b = 'B old';
}
$rc = new ReflectionClass(B::class);
A::$a = 'A new';
var_dump($rc->getStaticProperties());Incorrectly prints under opcache: |
This is necessary for inherited properties, and allows us to drop the check later. We also remove the unnecessary `IS_CONSTANT_AST` handling.
|
|
||
| /* copy: enforce read only access */ | ||
| ZVAL_DEREF(prop); | ||
| ZVAL_COPY_OR_DUP(&prop_copy, prop); |
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 CE_STATIC_MEMBERS is already per-request, so it's not necessary to COPY_OR_DUP. Just doing a Z_TRY_ADDREF_P(prop) is sufficient here.
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.
Fine! :)
nikic
left a comment
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.
LG apart from the comment.
|
Thanks! Applied as a895bb6. |
When retrieving the static class properties via reflection, we have to
cater to possible modifications.