From: Nikita Popov Date: Sat, 22 Jul 2017 15:21:48 +0000 (+0200) Subject: Fix incorrect propagation of ZEND_BOOL in pass 1 X-Git-Tag: php-7.2.0beta2~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4672411ef5f600b6e64e92098b98708351a65535;p=php Fix incorrect propagation of ZEND_BOOL in pass 1 BOOL (next to QM_ASSIGN) is one of the opcodes that can assign to a temporary that is assigned in multiple branches. Pass 1 does not check for this, so we should not try to handle it at that point. Block pass and sccp will be able to treat this correctly. --- diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 5374a1887e..7697fb1943 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -115,7 +115,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx) case ZEND_BW_NOT: case ZEND_BOOL_NOT: - case ZEND_BOOL: if (opline->op1_type == IS_CONST) { /* unary operation on constant operand */ zval result; diff --git a/ext/opcache/tests/bool_cp_in_pass1.phpt b/ext/opcache/tests/bool_cp_in_pass1.phpt new file mode 100644 index 0000000000..3857c4db30 --- /dev/null +++ b/ext/opcache/tests/bool_cp_in_pass1.phpt @@ -0,0 +1,15 @@ +--TEST-- +Incorrect constant propagation on BOOL in pass 1 +--FILE-- + +--EXPECT-- +foo