summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/opcache/Optimizer/block_pass.c5
-rw-r--r--ext/opcache/tests/block_pass_001.phpt8
2 files changed, 12 insertions, 1 deletions
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 242016e1b3..aea670beb3 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -1657,7 +1657,10 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
case ZEND_QM_ASSIGN:
case ZEND_BOOL:
case ZEND_BOOL_NOT:
- if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
+ if (ZEND_OP1_TYPE(opline) == IS_CV) {
+ opline->opcode = ZEND_CHECK_VAR;
+ SET_UNUSED(opline->result);
+ } else if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
opline->opcode = ZEND_FREE;
SET_UNUSED(opline->result);
} else {
diff --git a/ext/opcache/tests/block_pass_001.phpt b/ext/opcache/tests/block_pass_001.phpt
new file mode 100644
index 0000000000..8a1b691145
--- /dev/null
+++ b/ext/opcache/tests/block_pass_001.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Block pass: Don't suppress undefined variable notice
+--FILE--
+<?php
+(bool) (true ? $x : $y);
+?>
+--EXPECTF--
+Notice: Undefined variable: x in %s on line %d