From 3048428cf006cc96cc5867aacb5b0815548a9663 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 10 Nov 2016 14:54:41 +0100 Subject: [PATCH] Don't elide undef var notice --- ext/opcache/Optimizer/block_pass.c | 5 ++++- ext/opcache/tests/block_pass_001.phpt | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 ext/opcache/tests/block_pass_001.phpt 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-- + +--EXPECTF-- +Notice: Undefined variable: x in %s on line %d -- 2.50.1