com php-src: Fix constant expr coaleasce with protected mode opcache: Zend/zend_ast.c Zend/zend_compile.c
| From: | Bob Weinand | Date: | Thu, 21 Apr 2016 19:51:00 +0000 |
| Subject: | com php-src: Fix constant expr coaleasce with protected mode opcache: Zend/zend_ast.c Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91813@lists.php.net to get a copy of this message | ||
Commit: 69efeb1223916b73cc767d4c17069c8bee49365e
Author: Bob Weinand <bobwei9@hotmail.com> Thu, 21 Apr 2016 21:51:00 +0200
Parents: 5053fc078d2ae8ac57f1d3ff84eb31a4b2e05108
Branches: PHP-7.0
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=69efeb1223916b73cc767d4c17069c8bee49365e
Log:
Fix constant expr coaleasce with protected mode opcache
Changed paths:
M Zend/zend_ast.c
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_ast.c b/Zend/zend_ast..c
index 4d3678f..3772887 100644
--- a/Zend/zend_ast.c
+++ b/Zend/zend_ast.c
@@ -338,10 +338,6 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry
*sc
}
break;
case ZEND_AST_COALESCE:
- if (ast->child[0]->kind == ZEND_AST_DIM) {
- ast->child[0]->attr = ZEND_DIM_IS;
- }
-
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ret = FAILURE;
break;
@@ -349,10 +345,6 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry
*sc
if (Z_TYPE(op1) > IS_NULL) {
*result = op1;
} else {
- if (ast->child[1]->kind == ZEND_AST_DIM) {
- ast->child[1]->attr = ZEND_DIM_IS;
- }
-
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[1], scope) != SUCCESS)) {
zval_dtor(&op1);
ret = FAILURE;
@@ -413,10 +405,6 @@ ZEND_API int zend_ast_evaluate(zval *result, zend_ast *ast, zend_class_entry
*sc
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
}
- if (ast->attr == ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
- ast->child[0]->attr = ZEND_DIM_IS;
- }
-
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ret = FAILURE;
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 2057536..fb196f0 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -7388,6 +7388,10 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
zend_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0]));
break;
case ZEND_AST_COALESCE:
+ /* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
+ if (ast->child[0]->kind == ZEND_AST_DIM) {
+ ast->child[0]->attr = ZEND_DIM_IS;
+ }
zend_eval_const_expr(&ast->child[0]);
if (ast->child[0]->kind != ZEND_AST_ZVAL) {
@@ -7440,6 +7444,11 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
zend_error_noreturn(E_COMPILE_ERROR, "Cannot use [] for reading");
}
+ /* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
+ if (ast->attr == ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
+ ast->child[0]->attr = ZEND_DIM_IS;
+ }
+
zend_eval_const_expr(&ast->child[0]);
zend_eval_const_expr(&ast->child[1]);
if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) {