com php-src: Immutable arrays for the recursive case as well: Zend/zend_compile.c
| From: | Nikita Popov | Date: | Wed, 30 Jul 2014 11:43:04 +0000 |
| Subject: | com php-src: Immutable arrays for the recursive case as well: Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80880@lists.php.net to get a copy of this message | ||
Commit: 3630f03f8f6f35bed031dbf1c7bc077bb4bcd596
Author: Nikita Popov <nikic@php.net> Wed, 30 Jul 2014 13:43:04 +0200
Parents: 8cab06f09b107d62bacd4bb70c01b94217179b45
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3630f03f8f6f35bed031dbf1c7bc077bb4bcd596
Log:
Immutable arrays for the recursive case as well
Changed paths:
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e642210..bc9f468 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6422,12 +6422,12 @@ zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast TSRMLS_DC) {
/* First ensure that *all* child nodes are constant and by-val */
for (i = 0; i < list->children; ++i) {
zend_ast *elem_ast = list->child[i];
- zend_ast *value_ast = elem_ast->child[0];
- zend_ast *key_ast = elem_ast->child[1];
zend_bool by_ref = elem_ast->attr;
+ zend_eval_const_expr(&elem_ast->child[0] TSRMLS_CC);
+ zend_eval_const_expr(&elem_ast->child[1] TSRMLS_CC);
- if (by_ref || (key_ast && key_ast->kind != ZEND_AST_ZVAL)
- || value_ast->kind != ZEND_AST_ZVAL
+ if (by_ref || elem_ast->child[0]->kind != ZEND_AST_ZVAL
+ || (elem_ast->child[1] && elem_ast->child[1]->kind != ZEND_AST_ZVAL)
) {
return 0;
}
@@ -7573,7 +7573,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC) {
zend_ast *ast = *ast_ptr;
zval result;
- if (!ast || ast->kind == ZEND_AST_ZVAL || ast->kind == ZEND_AST_ZNODE) {
+ if (!ast || ast->kind == ZEND_AST_ZVAL) {
return;
}