diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-24 11:19:17 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-24 11:19:17 +0200 |
commit | cbce0cbacbbe264878a2eedf945460929b9a2b72 (patch) | |
tree | 0fbdde0f1e63d7c1967622a554884fff1c2c962e /ext/reflection/php_reflection.c | |
parent | 59c4c8297bd02b9148b5111e3d5af838027c8f93 (diff) | |
parent | 26aefb750a614391cdb8ee3f63d66f46ed57bd55 (diff) | |
download | php-git-cbce0cbacbbe264878a2eedf945460929b9a2b72.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Fix #69804: ::getStaticPropertyValue() throws on protected props
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 2208b76aa9..8f0e22dd04 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3933,7 +3933,7 @@ ZEND_METHOD(ReflectionClass, getStaticProperties) ZEND_METHOD(ReflectionClass, getStaticPropertyValue) { reflection_object *intern; - zend_class_entry *ce; + zend_class_entry *ce, *old_scope; zend_string *name; zval *prop, *def_value = NULL; @@ -3946,7 +3946,12 @@ ZEND_METHOD(ReflectionClass, getStaticPropertyValue) if (UNEXPECTED(zend_update_class_constants(ce) != SUCCESS)) { return; } + + old_scope = EG(fake_scope); + EG(fake_scope) = ce; prop = zend_std_get_static_property(ce, name, BP_VAR_IS); + EG(fake_scope) = old_scope; + if (!prop) { if (def_value) { ZVAL_COPY(return_value, def_value); @@ -3966,7 +3971,7 @@ ZEND_METHOD(ReflectionClass, getStaticPropertyValue) ZEND_METHOD(ReflectionClass, setStaticPropertyValue) { reflection_object *intern; - zend_class_entry *ce; + zend_class_entry *ce, *old_scope; zend_property_info *prop_info; zend_string *name; zval *variable_ptr, *value; @@ -3980,7 +3985,10 @@ ZEND_METHOD(ReflectionClass, setStaticPropertyValue) if (UNEXPECTED(zend_update_class_constants(ce) != SUCCESS)) { return; } - variable_ptr = zend_std_get_static_property_with_info(ce, name, BP_VAR_W, &prop_info); + old_scope = EG(fake_scope); + EG(fake_scope) = ce; + variable_ptr = zend_std_get_static_property_with_info(ce, name, BP_VAR_W, &prop_info); + EG(fake_scope) = old_scope; if (!variable_ptr) { zend_clear_exception(); zend_throw_exception_ex(reflection_exception_ptr, 0, |