com php-src: Fixed bug #76466 (Loop variable confusion): NEWS ext/opcache/Optimizer/sccp.c ext/opcache/tests/bug76466.phpt
| From: | Dmitry Stogov | Date: | Mon, 18 Jun 2018 08:21:23 +0000 |
| Subject: | com php-src: Fixed bug #76466 (Loop variable confusion): NEWS ext/opcache/Optimizer/sccp.c ext/opcache/tests/bug76466.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102185@lists.php.net to get a copy of this message | ||
Commit: 84d7d4e1cc49e657068ddd6f2c57a93165ffb1a5
Author: Dmitry Stogov <dmitry@zend.com> Mon, 18 Jun 2018 11:21:23 +0300
Parents: 83a77f5a285f2d0b51781d2437311836d5631744
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=84d7d4e1cc49e657068ddd6f2c57a93165ffb1a5
Log:
Fixed bug #76466 (Loop variable confusion)
Bugs:
https://bugs.php.net/76466
Changed paths:
M NEWS
M ext/opcache/Optimizer/sccp.c
A ext/opcache/tests/bug76466.phpt
Diff:
diff --git a/NEWS b/NEWS
index 70b13aa..272a925 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@ PHP NEWS
- Opcache:
. Fixed bug #76477 (Opcache causes empty return value).
(Nikita, Laruence)
+ . Fixed bug #76466 (Loop variable confusion). (Dmitry, Laruence, Nikita)
. Fixed bug #76463 (var has array key type but not value type). (Laruence)
. Fixed bug #76446 (zend_variables.c:73: zend_string_destroy: Assertion
`!(zval_gc_flags((str)->gc)). (Nikita, Laruence)
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 5511313..c9acb04 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -1230,6 +1230,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op
*ssa_o
* ADD_ARRAY_ELEMENT chain. We do this by only keeping the array on the last opcode
* and use a NULL value everywhere else. */
if (Z_TYPE(ctx->values[ssa_op->result_def]) == IS_NULL) {
+ SET_RESULT_BOT(result);
return;
}
diff --git a/ext/opcache/tests/bug76466.phpt b/ext/opcache/tests/bug76466.phpt
new file mode 100644
index 0000000..0f492fb
--- /dev/null
+++ b/ext/opcache/tests/bug76466.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Bug #76466 Loop variable confusion
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function foo() {
+ for ($i = 0; $i < 2; $i++) {
+ $field_array[] = [$i, 0];
+ }
+ var_dump($field_array);
+}
+foo();
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ array(2) {
+ [0]=>
+ int(0)
+ [1]=>
+ int(0)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(0)
+ }
+}