Skip to content

Commit f3cccfd

Browse files
committed
Revert "Fix #79487: ::getStaticProperties() ignores property modifications"
This reverts commit a895bb6.
1 parent a895bb6 commit f3cccfd

File tree

3 files changed

+4
-69
lines changed

3 files changed

+4
-69
lines changed

NEWS

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ PHP NEWS
55
- FTP:
66
. Fixed bug #55857 (ftp_size on large files). (cmb)
77

8-
- Reflection:
9-
. Fixed bug #79487 (::getStaticProperties() ignores property modifications).
10-
(cmb, Nikita)
11-
128
?? ??? 2020, PHP 7.4.8
139

1410
- Core:

ext/reflection/php_reflection.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3726,7 +3726,9 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
37263726
zend_string *key;
37273727

37283728
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
3729-
if (((prop_info->flags & ZEND_ACC_PRIVATE) &&
3729+
if (((prop_info->flags & ZEND_ACC_PROTECTED) &&
3730+
!zend_check_protected(prop_info->ce, ce)) ||
3731+
((prop_info->flags & ZEND_ACC_PRIVATE) &&
37303732
prop_info->ce != ce)) {
37313733
continue;
37323734
}
@@ -3764,9 +3766,6 @@ ZEND_METHOD(reflection_class, getStaticProperties)
37643766
{
37653767
reflection_object *intern;
37663768
zend_class_entry *ce;
3767-
zend_property_info *prop_info;
3768-
zval *prop;
3769-
zend_string *key;
37703769

37713770
if (zend_parse_parameters_none() == FAILURE) {
37723771
return;
@@ -3778,34 +3777,8 @@ ZEND_METHOD(reflection_class, getStaticProperties)
37783777
return;
37793778
}
37803779

3781-
if (!CE_STATIC_MEMBERS(ce)) {
3782-
zend_class_init_statics(ce);
3783-
}
3784-
37853780
array_init(return_value);
3786-
3787-
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
3788-
if (((prop_info->flags & ZEND_ACC_PRIVATE) &&
3789-
prop_info->ce != ce)) {
3790-
continue;
3791-
}
3792-
if ((prop_info->flags & ZEND_ACC_STATIC) == 0) {
3793-
continue;
3794-
}
3795-
3796-
prop = &CE_STATIC_MEMBERS(ce)[prop_info->offset];
3797-
ZVAL_DEINDIRECT(prop);
3798-
3799-
if (prop_info->type && Z_ISUNDEF_P(prop)) {
3800-
continue;
3801-
}
3802-
3803-
/* enforce read only access */
3804-
ZVAL_DEREF(prop);
3805-
Z_TRY_ADDREF_P(prop);
3806-
3807-
zend_hash_update(Z_ARRVAL_P(return_value), key, prop);
3808-
} ZEND_HASH_FOREACH_END();
3781+
add_class_vars(ce, 1, return_value);
38093782
}
38103783
/* }}} */
38113784

ext/reflection/tests/bug79487.phpt

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)