]> granicus.if.org Git - php/commitdiff
Fixed bug #71127 (Define in auto_prepend_file is overwrite)
authorXinchen Hui <laruence@gmail.com>
Thu, 17 Dec 2015 06:27:33 +0000 (14:27 +0800)
committerXinchen Hui <laruence@gmail.com>
Thu, 17 Dec 2015 06:27:33 +0000 (14:27 +0800)
NEWS
ext/opcache/Optimizer/pass1_5.c
ext/opcache/tests/bug71127.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 99ec4682d3af76887f9c6283d146c7d5783c0e5f..5f8c1c0cfcc09ebe6e30e135c65b332b90aa6ddf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PHP                                                                        NEWS
     (abrender at elitehosts dot com)
 
 - Opcache:
+  . Fixed bug #71127 (Define in auto_prepend_file is overwrite). (Laruence)
   . Fixed bug #71024 (Unable to use PHP 7.0 x64 side-by-side with PHP 5.6 x32
     on the same server). (Anatol)
 
index 1302e4b1826504c23aa12c82761b7e2911373c0c..f252117de74af7a6c9e2598befaccb0e533ccac9 100644 (file)
@@ -16,7 +16,9 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
        int i = 0;
        zend_op *opline = op_array->opcodes;
        zend_op *end = opline + op_array->last;
-       zend_bool collect_constants = (op_array == &script->main_op_array);
+       /* bug #71127*
+        zend_bool collect_constants = (op_array == &script->main_op_array); */
+       zend_bool collect_constants = 0;
 
        while (opline < end) {
                switch (opline->opcode) {
diff --git a/ext/opcache/tests/bug71127.phpt b/ext/opcache/tests/bug71127.phpt
new file mode 100644 (file)
index 0000000..78c5535
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #71127 (Define in auto_prepend_file is overwrite)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
+--FILE--
+<?php
+$file = __DIR__ . "/bug71127.inc";
+
+file_put_contents($file, "<?php define('FOO', 'bad'); echo FOO;?>");
+
+define("FOO", "okey");
+
+include($file);
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . "/bug71127.inc");
+?>
+--EXPECTF--
+Notice: Constant FOO already defined in %sbug71127.inc on line %d
+okey