com php-src: Fixed constant expressions in array indeces handling: Zend/zend_compile.c Zend/zend_execute_API.c
| From: | Dmitry Stogov | Date: | Thu, 27 Feb 2014 12:41:41 +0000 |
| Subject: | com php-src: Fixed constant expressions in array indeces handling: Zend/zend_compile.c Zend/zend_execute_API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77854@lists.php.net to get a copy of this message | ||
Commit: 3810b4ab4ad220d6c682879d79a7941cba62feae
Author: Dmitry Stogov <dmitry@zend.com> Thu, 27 Feb 2014 16:41:41 +0400
Parents: 3696e038e5e52cb231b5f0004c53cafed04f90c7
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3810b4ab4ad220d6c682879d79a7941cba62feae
Log:
Fixed constant expressions in array indeces handling
Changed paths:
M Zend/zend_compile.c
M Zend/zend_execute_API.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 4069437..50283d1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5908,9 +5908,8 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const
znode
zend_string *key;
//??? int len = sizeof(zend_ast *);
//??? Z_TYPE(element) |= IS_CONSTANT_INDEX;
- Z_STR(offset->u.constant)->gc.u.v.flags |= IS_STR_AST;
-
- key = STR_INIT((char*)Z_AST(offset->u.constant), sizeof(zend_ast*), 0);
+ key = STR_INIT((char*)&Z_AST(offset->u.constant), sizeof(zend_ast*), 0);
+ key->gc.u.v.flags |= IS_STR_AST;
//??? key[len] = Z_TYPE(offset->u.constant);
//??? key[len + 1] = 0;
zend_symtable_update(Z_ARRVAL(result->u.constant), key, &element);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index e81339b..cf634b6 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -582,8 +582,11 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry
*scope
}
if (str_index->gc.u.v.flags & IS_STR_AST) {
- zend_ast_evaluate(&const_value, (zend_ast *)str_index->val, scope TSRMLS_CC);
- zend_ast_destroy((zend_ast *)str_index->val);
+ zend_ast_ref *ast = *(zend_ast_ref **)str_index->val;
+
+ zend_ast_evaluate(&const_value, ast->ast, scope TSRMLS_CC);
+ zend_ast_destroy(ast->ast);
+ efree(ast);
//???
} else if (!zend_get_constant_ex(str_index->val, str_index->len, &const_value, scope,
str_index->gc.u.v.flags TSRMLS_CC)) {
char *actual, *str;