From: Nikita Popov Date: Fri, 29 Apr 2016 20:39:21 +0000 (+0200) Subject: Reset IMMUTABLE flag when copy_ctor'ing AST X-Git-Tag: php-7.1.0alpha1~233^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01df044fd54ee6728ef3b10dd073ca6c2750fd77;p=php Reset IMMUTABLE flag when copy_ctor'ing AST --- diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 6f2dd0421c..01b68c25a4 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -224,12 +224,8 @@ ZEND_API void ZEND_FASTCALL _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) CHECK_ZVAL_STRING_REL(Z_STR_P(zvalue)); Z_STR_P(zvalue) = zend_string_dup(Z_STR_P(zvalue), 0); } else if (EXPECTED(Z_TYPE_P(zvalue) == IS_CONSTANT_AST)) { - zend_ast_ref *ast = emalloc(sizeof(zend_ast_ref)); - - GC_REFCOUNT(ast) = 1; - GC_TYPE_INFO(ast) = IS_CONSTANT_AST; - ast->ast = zend_ast_copy(Z_ASTVAL_P(zvalue)); - Z_AST_P(zvalue) = ast; + zend_ast *copy = zend_ast_copy(Z_ASTVAL_P(zvalue)); + ZVAL_NEW_AST(zvalue, copy); } }