Skip to content

Commit cf70026

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Revert "Fix #79487: ::getStaticProperties() ignores property modifications"
2 parents f1d0ead + f3cccfd commit cf70026

File tree

2 files changed

+4
-65
lines changed

2 files changed

+4
-65
lines changed

ext/reflection/php_reflection.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3845,7 +3845,9 @@ static void add_class_vars(zend_class_entry *ce, zend_bool statics, zval *return
38453845
zend_string *key;
38463846

38473847
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
3848-
if (((prop_info->flags & ZEND_ACC_PRIVATE) &&
3848+
if (((prop_info->flags & ZEND_ACC_PROTECTED) &&
3849+
!zend_check_protected(prop_info->ce, ce)) ||
3850+
((prop_info->flags & ZEND_ACC_PRIVATE) &&
38493851
prop_info->ce != ce)) {
38503852
continue;
38513853
}
@@ -3883,9 +3885,6 @@ ZEND_METHOD(ReflectionClass, getStaticProperties)
38833885
{
38843886
reflection_object *intern;
38853887
zend_class_entry *ce;
3886-
zend_property_info *prop_info;
3887-
zval *prop;
3888-
zend_string *key;
38893888

38903889
if (zend_parse_parameters_none() == FAILURE) {
38913890
RETURN_THROWS();
@@ -3897,34 +3896,8 @@ ZEND_METHOD(ReflectionClass, getStaticProperties)
38973896
return;
38983897
}
38993898

3900-
if (!CE_STATIC_MEMBERS(ce)) {
3901-
zend_class_init_statics(ce);
3902-
}
3903-
39043899
array_init(return_value);
3905-
3906-
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
3907-
if (((prop_info->flags & ZEND_ACC_PRIVATE) &&
3908-
prop_info->ce != ce)) {
3909-
continue;
3910-
}
3911-
if ((prop_info->flags & ZEND_ACC_STATIC) == 0) {
3912-
continue;
3913-
}
3914-
3915-
prop = &CE_STATIC_MEMBERS(ce)[prop_info->offset];
3916-
ZVAL_DEINDIRECT(prop);
3917-
3918-
if (prop_info->type && Z_ISUNDEF_P(prop)) {
3919-
continue;
3920-
}
3921-
3922-
/* enforce read only access */
3923-
ZVAL_DEREF(prop);
3924-
Z_TRY_ADDREF_P(prop);
3925-
3926-
zend_hash_update(Z_ARRVAL_P(return_value), key, prop);
3927-
} ZEND_HASH_FOREACH_END();
3900+
add_class_vars(ce, 1, return_value);
39283901
}
39293902
/* }}} */
39303903

ext/reflection/tests/bug79487.phpt

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

0 commit comments

Comments
 (0)