com php-src: Fix usages of zend_update_constant_ex: Z end/zend_execute_API.c Zend/zend_ini_parser.y e xt/reflection/php_reflection.c
ext/standard/basic_funct ions.c
| From: | Nikita Popov | Date: | Fri, 29 Apr 2016 12:06:39 +0000 |
| Subject: | com php-src: Fix usages of zend_update_constant_ex: Z end/zend_execute_API.c Zend/zend_ini_parser.y e xt/reflection/php_reflection.c ext/standard/basic_funct ions.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91970@lists.php.net to get a copy of this message | ||
Commit: a1c405e0c50c627cdd9a7695b4c7d644238b6b9b
Author: Nikita Popov <nikic@php.net> Fri, 29 Apr 2016 14:04:23 +0200
Parents: 416e22d2bb496da39e95136b1eded64869f10dd0
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a1c405e0c50c627cdd9a7695b4c7d644238b6b9b
Log:
Fix usages of zend_update_constant_ex
If an in-place update in an external zval is performed, it needs
to incref'd beforehand, not afterwards.
Changed paths:
M Zend/zend_execute_API.c
M Zend/zend_ini_parser.y
M ext/reflection/php_reflection.c
M ext/standard/basic_functions.c
Diff:
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 6bb833f..2acf29c 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -646,12 +646,6 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_class_entry *scope) /* {{{
*/
zend_string_release(Z_STR_P(p));
}
ZVAL_COPY_VALUE(p, const_value);
- if (Z_OPT_CONSTANT_P(p)) {
- if (UNEXPECTED(zval_update_constant_ex(p, scope) != SUCCESS)) {
- RESET_CONSTANT_VISITED(p);
- return FAILURE;
- }
- }
zval_opt_copy_ctor(p);
}
} else if (Z_TYPE_P(p) == IS_CONSTANT_AST) {
diff --git a/Zend/zend_ini_parser.y b/Zend/zend_ini_parser.y
index 315455b..ed047c0 100644
--- a/Zend/zend_ini_parser.y
+++ b/Zend/zend_ini_parser.y
@@ -132,11 +132,10 @@ static void zend_ini_get_constant(zval *result, zval *name)
if (!memchr(Z_STRVAL_P(name), ':', Z_STRLEN_P(name))
&& (c = zend_get_constant(Z_STR_P(name))) != 0) {
if (Z_TYPE_P(c) != IS_STRING) {
- ZVAL_COPY_VALUE(&tmp, c);
+ ZVAL_COPY(&tmp, c);
if (Z_OPT_CONSTANT(tmp)) {
zval_update_constant_ex(&tmp, NULL);
}
- zval_opt_copy_ctor(&tmp);
convert_to_string(&tmp);
c = &tmp;
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index b4bd651..d618627 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2884,11 +2884,9 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
return;
}
- ZVAL_COPY_VALUE(return_value, RT_CONSTANT(¶m->fptr->op_array, precv->op2));
+ ZVAL_COPY(return_value, RT_CONSTANT(¶m->fptr->op_array, precv->op2));
if (Z_CONSTANT_P(return_value)) {
zval_update_constant_ex(return_value, param->fptr->common.scope);
- } else {
- zval_copy_ctor(return_value);
}
}
/* }}} */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 0481e41..dcd0b0f 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -3843,13 +3843,12 @@ PHP_FUNCTION(constant)
scope = zend_get_executed_scope();
c = zend_get_constant_ex(const_name, scope, ZEND_FETCH_CLASS_SILENT);
if (c) {
- ZVAL_COPY_VALUE(return_value, c);
+ ZVAL_COPY(return_value, c);
if (Z_CONSTANT_P(return_value)) {
if (UNEXPECTED(zval_update_constant_ex(return_value, scope) != SUCCESS)) {
return;
}
}
- zval_copy_ctor(return_value);
} else {
php_error_docref(NULL, E_WARNING, "Couldn't find constant %s",
ZSTR_VAL(const_name));
RETURN_NULL();