com php-src: Fix off by one in short_circuiting optimizatio n: Zend/zend_compile.c

From: Date: Sun, 14 Jun 2015 15:47:35 +0000
Subject: com php-src: Fix off by one in short_circuiting optimizatio n: Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87261@lists.php.net to get a copy of this message
Commit: 37c91b8d0391ce8a08e9cd9da4a674d3857ff96f Author: Bob Weinand <bobwei9@hotmail.com> Sun, 14 Jun 2015 17:08:39 +0200 Parents: b7e477a8f9096d35360e23224849e70947eaefec Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=37c91b8d0391ce8a08e9cd9da4a674d3857ff96f Log: Fix off by one in short_circuiting optimization Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 6164242..bd7b65f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5842,7 +5842,7 @@ void zend_compile_short_circuiting(znode *result, zend_ast *ast) /* {{{ */ if (left_node.op_type == IS_CONST) { if ((ast->kind == ZEND_AST_AND && !zend_is_true(&left_node.u.constant)) - || (ast->kind == ZEND_AST_OR && zend_is_true(&left_node.u.constant))) { + || (ast->kind == ZEND_AST_OR && zend_is_true(&left_node.u.constant))) { result->op_type = IS_CONST; ZVAL_BOOL(&result->u.constant, zend_is_true(&left_node.u.constant)); } else { @@ -5875,9 +5875,9 @@ void zend_compile_short_circuiting(znode *result, zend_ast *ast) /* {{{ */ zend_compile_expr(&right_node, right_ast); - if (right_node.op_type == IS_CONST && opnum_jmpz == CG(active_op_array)->last) { + if (right_node.op_type == IS_CONST && opnum_jmpz == get_next_op_number(CG(active_op_array)) - 1) { if ((ast->kind == ZEND_AST_AND && !zend_is_true(&right_node.u.constant)) - || (ast->kind == ZEND_AST_OR && zend_is_true(&right_node.u.constant))) { + || (ast->kind == ZEND_AST_OR && zend_is_true(&right_node.u.constant))) { CG(active_op_array)->last--; result->op_type = IS_CONST; ZVAL_BOOL(&result->u.constant, zend_is_true(&right_node.u.constant));

« previous php.cvs (#87261) next »