diff options
author | Joe Watkins <krakjoe@php.net> | 2015-12-06 10:04:59 +0000 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2015-12-06 10:04:59 +0000 |
commit | ee704bff7800db6ad9a8eee3f93f9c03ad7f7ee3 (patch) | |
tree | 7339a8e458eae997bec084e25f51639835d21522 /ext/reflection/php_reflection.c | |
parent | 003c91bd9b24815b286940cdede2815e2be02c3e (diff) | |
parent | 6e664f60c35269190b37c3327c6dd65ec57d4f30 (diff) | |
download | php-git-ee704bff7800db6ad9a8eee3f93f9c03ad7f7ee3.tar.gz |
Merge branch 'master' of https://github.com/php/php-src
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r-- | ext/reflection/php_reflection.c | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index faced0572c..80001e4997 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3858,6 +3858,7 @@ ZEND_METHOD(reflection_class, setStaticPropertyValue) "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); return; } + ZVAL_DEREF(variable_ptr); zval_ptr_dtor(variable_ptr); ZVAL_COPY(variable_ptr, value); } @@ -5447,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; |