com php-src: Don't elide undef var notice: ext/opcache/Optimize r/block_pass.c ext/opcache/tests/block_pass_001 .phpt
| From: | Nikita Popov | Date: | Thu, 10 Nov 2016 13:58:54 +0000 |
| Subject: | com php-src: Don't elide undef var notice: ext/opcache/Optimize r/block_pass.c ext/opcache/tests/block_pass_001 .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95486@lists.php.net to get a copy of this message | ||
Commit: 3048428cf006cc96cc5867aacb5b0815548a9663
Author: Nikita Popov <nikic@php.net> Thu, 10 Nov 2016 14:54:41 +0100
Parents: 4f76073b6d084b168f8be0eb4239d9b47894b1c8
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3048428cf006cc96cc5867aacb5b0815548a9663
Log:
Don't elide undef var notice
Changed paths:
M ext/opcache/Optimizer/block_pass.c
A ext/opcache/tests/block_pass_001.phpt
Diff:
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 242016e..aea670b 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 0000000..8a1b691
--- /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