com php-src: Weaker recursion during pre-evaluation: Zend/zend_compile.c

From: Date: Wed, 30 Jul 2014 15:29:59 +0000
Subject: com php-src: Weaker recursion during pre-evaluation: Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-80878@lists.php.net to get a copy of this message
Commit: 044e48d0b11e5b061bcf88c381eadced5ef4c7d2 Author: Nikita Popov <nikic@php.net> Wed, 30 Jul 2014 17:29:59 +0200 Parents: 3630f03f8f6f35bed031dbf1c7bc077bb4bcd596 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=044e48d0b11e5b061bcf88c381eadced5ef4c7d2 Log: Weaker recursion during pre-evaluation Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index bc9f468..8683ca9 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7263,8 +7263,6 @@ void zend_compile_const_expr(zend_ast **ast_ptr TSRMLS_DC) { zend_error_noreturn(E_COMPILE_ERROR, "Constant expression contains invalid operations"); } - zend_ast_apply(ast, zend_compile_const_expr TSRMLS_CC); - switch (ast->kind) { case ZEND_AST_CLASS_CONST: zend_compile_const_expr_class_const(ast_ptr TSRMLS_CC); @@ -7278,6 +7276,9 @@ void zend_compile_const_expr(zend_ast **ast_ptr TSRMLS_DC) { case ZEND_AST_MAGIC_CONST: zend_compile_const_expr_magic_const(ast_ptr TSRMLS_CC); break; + default: + zend_ast_apply(ast, zend_compile_const_expr TSRMLS_CC); + break; } } @@ -7573,14 +7574,14 @@ 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) { + if (!ast) { return; } - zend_ast_apply(ast, zend_eval_const_expr TSRMLS_CC); - switch (ast->kind) { case ZEND_AST_BINARY_OP: + zend_eval_const_expr(&ast->child[0] TSRMLS_CC); + zend_eval_const_expr(&ast->child[1] TSRMLS_CC); if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) { return; } @@ -7590,6 +7591,8 @@ void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC) { break; case ZEND_AST_GREATER: case ZEND_AST_GREATER_EQUAL: + zend_eval_const_expr(&ast->child[0] TSRMLS_CC); + zend_eval_const_expr(&ast->child[1] TSRMLS_CC); if (ast->child[0]->kind != ZEND_AST_ZVAL || ast->child[1]->kind != ZEND_AST_ZVAL) { return; } @@ -7599,6 +7602,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr TSRMLS_DC) { break; case ZEND_AST_UNARY_PLUS: case ZEND_AST_UNARY_MINUS: + zend_eval_const_expr(&ast->child[0] TSRMLS_CC); if (ast->child[0]->kind != ZEND_AST_ZVAL) { return; }

« previous php.cvs (#80878) next »