diff options
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, |