]> granicus.if.org Git - php/commitdiff
Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS)
authorDmitry Stogov <dmitry@zend.com>
Mon, 16 Dec 2019 09:24:47 +0000 (12:24 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 16 Dec 2019 09:24:47 +0000 (12:24 +0300)
NEWS
ext/opcache/Optimizer/pass1_5.c
ext/opcache/tests/bug78961.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 8bcd28fe5a78093b116efaed62edf87d88b3a24d..9388881ab1b1e48e5dfcdf8c7159d0b742fe70f9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ PHP                                                                        NEWS
     (Alexey Kachalin)
 
 - OPcache:
+  . Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS). (Dmitry)
   . Fixed bug #78950 (Preloading trait method with static variables). (Nikita)
   . Fixed bug #78903 (Conflict in RTD key for closures results in crash).
     (Nikita)
index 8ae1d34fc0a6d81dd6c45874bb5ad1ff3c1e5137..8f4173011475dd99068e8b2c2cd8ff34592db61b 100644 (file)
@@ -515,6 +515,8 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
                                zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
                        }
                        break;
+#if 0
+               /* see ext/opcache/tests/bug78961.phpt */
 //             case ZEND_FETCH_R:
                case ZEND_FETCH_W:
 //             case ZEND_FETCH_RW:
@@ -558,6 +560,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
                                MAKE_NOP(opline);
                        }
                        break;
+#endif
 
                case ZEND_RETURN:
                case ZEND_RETURN_BY_REF:
diff --git a/ext/opcache/tests/bug78961.phpt b/ext/opcache/tests/bug78961.phpt
new file mode 100644 (file)
index 0000000..736a747
--- /dev/null
@@ -0,0 +1,17 @@
+--TEST--
+Bug #78961 (erroneous optimization of re-assigned $GLOBALS)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$GLOBALS = array();
+$GLOBALS['td'] = array();
+$GLOBALS['td']['nsno'] = 3;
+var_dump($GLOBALS['td']['nsno']);
+?>
+--EXPECT--
+int(3)