summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-12-04 11:10:07 +0800
committerXinchen Hui <laruence@gmail.com>2015-12-04 11:52:08 +0800
commit3ae3341533b68cccaccfc0d78456b72d004dfc80 (patch)
treedd737758dc7630ddb8d48d1ac2eeb5f82dcef4ea /ext/reflection/php_reflection.c
parent5b9267c4c0909b3c3ba27326bda9020d4a1c4470 (diff)
downloadphp-git-3ae3341533b68cccaccfc0d78456b72d004dfc80.tar.gz
Fixed bug #71018 (ReflectionProperty::setValue() behavior changed)
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 72df8b5901..80001e4997 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5448,31 +5448,16 @@ ZEND_METHOD(reflection_property, setValue)
}
variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
if (variable_ptr != value) {
- if (Z_ISREF_P(variable_ptr)) {
- zval garbage;
+ zval garbage;
- ZVAL_COPY_VALUE(&garbage, variable_ptr); /* old value should be destroyed */
+ ZVAL_DEREF(variable_ptr);
+ ZVAL_DEREF(value);
- /* To check: can't *variable_ptr be some system variable like error_zval here? */
- ZVAL_COPY_VALUE(variable_ptr, value);
- if (Z_REFCOUNTED_P(value) && Z_REFCOUNT_P(value) > 0) {
- zval_copy_ctor(variable_ptr);
- }
- zval_dtor(&garbage);
- } else {
- zval garbage;
+ ZVAL_COPY_VALUE(&garbage, variable_ptr);
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
- /* if we assign referenced variable, we should separate it */
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
- if (Z_ISREF_P(value)) {
- SEPARATE_ZVAL(value);
- }
- ZVAL_COPY_VALUE(variable_ptr, value);
- zval_ptr_dtor(&garbage);
- }
+ ZVAL_COPY(variable_ptr, value);
+
+ zval_ptr_dtor(&garbage);
}
} else {
const char *class_name, *prop_name;