com php-src: Merge remote-tracking branch 'origin/PHP-7.0': Zend/tests/constant_expressions_dynamic.phpt Zend/zend _compile.c
| From: | Bob Weinand | Date: | Thu, 21 Apr 2016 00:50:14 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/PHP-7.0': Zend/tests/constant_expressions_dynamic.phpt Zend/zend _compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91809@lists.php.net to get a copy of this message | ||
Commit: ecf6392243b90e6c8f5597076b11b4959bac9dc1
Author: Bob Weinand <bobwei9@hotmail.com> Thu, 21 Apr 2016 02:50:14 +0200
Parents: 36202ef0569db9039c683cf8b2245ca54cd6da46 5053fc078d2ae8ac57f1d3ff84eb31a4b2e05108
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ecf6392243b90e6c8f5597076b11b4959bac9dc1
Log:
Merge remote-tracking branch 'origin/PHP-7.0'
Changed paths:
MM Zend/tests/constant_expressions_dynamic.phpt
MM Zend/zend_compile.c
Diff:
diff --cc Zend/zend_compile.c
index 842fa64,2057536..af2d2e9
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@@ -7862,10 -7385,28 +7864,30 @@@ void zend_eval_const_expr(zend_ast **as
return;
}
- zend_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0]));
+ if (!zend_try_ct_eval_unary_pm(&result, ast->kind, zend_ast_get_zval(ast->child[0])))
{
+ return;
+ }
break;
+ case ZEND_AST_COALESCE:
+ zend_eval_const_expr(&ast->child[0]);
+
+ if (ast->child[0]->kind != ZEND_AST_ZVAL) {
+ /* ensure everything was compile-time evaluated at least once */
+ zend_eval_const_expr(&ast->child[1]);
+ return;
+ }
+
+ if (Z_TYPE_P(zend_ast_get_zval(ast->child[0])) == IS_NULL) {
+ zend_eval_const_expr(&ast->child[1]);
+ *ast_ptr = ast->child[1];
+ ast->child[1] = NULL;
+ zend_ast_destroy(ast);
+ } else {
+ *ast_ptr = ast->child[0];
+ ast->child[0] = NULL;
+ zend_ast_destroy(ast);
+ }
+ return;
case ZEND_AST_CONDITIONAL:
{
zend_ast **child, *child_ast;