From: Christoph M. Becker Date: Wed, 24 Jun 2020 08:07:24 +0000 (+0200) Subject: Merge branch 'PHP-7.4' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1dfeb70e6be3225a1ad0d17b991c23fa81405583;p=php Merge branch 'PHP-7.4' * PHP-7.4: Fix #79487: ::getStaticProperties() ignores property modifications --- 1dfeb70e6be3225a1ad0d17b991c23fa81405583 diff --cc ext/reflection/php_reflection.c index 0a116a0127,f4d27b580b..2208b76aa9 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@@ -3885,9 -3764,12 +3883,12 @@@ ZEND_METHOD(ReflectionClass, getStaticP { reflection_object *intern; zend_class_entry *ce; + zend_property_info *prop_info; + zval *prop; + zend_string *key; if (zend_parse_parameters_none() == FAILURE) { - return; + RETURN_THROWS(); } GET_REFLECTION_OBJECT_PTR(ce); @@@ -3896,8 -3778,34 +3897,34 @@@ return; } + if (ce->default_static_members_count && !CE_STATIC_MEMBERS(ce)) { + zend_class_init_statics(ce); + } + array_init(return_value); - add_class_vars(ce, 1, return_value); + + ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) { + if (((prop_info->flags & ZEND_ACC_PRIVATE) && + prop_info->ce != ce)) { + continue; + } + if ((prop_info->flags & ZEND_ACC_STATIC) == 0) { + continue; + } + + prop = &CE_STATIC_MEMBERS(ce)[prop_info->offset]; + ZVAL_DEINDIRECT(prop); + - if (prop_info->type && Z_ISUNDEF_P(prop)) { ++ if (ZEND_TYPE_IS_SET(prop_info->type) && Z_ISUNDEF_P(prop)) { + continue; + } + + /* enforce read only access */ + ZVAL_DEREF(prop); + Z_TRY_ADDREF_P(prop); + + zend_hash_update(Z_ARRVAL_P(return_value), key, prop); + } ZEND_HASH_FOREACH_END(); } /* }}} */