From: Dmitry Stogov Date: Thu, 20 Mar 2014 21:08:26 +0000 (+0400) Subject: Fixed refcounting (proper fix) X-Git-Tag: POST_PHPNG_MERGE~412^2~250 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6123deb30fcd04e3f4c3e7d388705591e44142f9;p=php Fixed refcounting (proper fix) --- diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index b3dc41ac1a..613f4a1e29 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -623,7 +623,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str, str); } if (str == str_index->val && len == str_index->len) { - ZVAL_STR(&const_value, str_index); + ZVAL_STR(&const_value, STR_COPY(str_index)); } else { ZVAL_STRINGL(&const_value, str, len); } @@ -640,7 +640,6 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope switch (Z_TYPE(const_value)) { case IS_STRING: - Z_ADDREF(const_value); ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STR(const_value), HASH_UPDATE_KEY_IF_BEFORE); break; case IS_BOOL: @@ -660,7 +659,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope if (ret == SUCCESS) { zend_hash_move_forward(Z_ARRVAL_P(p)); } - zval_ptr_dtor(&const_value); + zval_dtor(&const_value); } zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant_inline_change, (void *) scope TSRMLS_CC); zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));