com php-src: Fixed bug #71127 (Define in auto_prepend_file is overwrite): NEWS ext/opcache/Optimizer/pass1 _5.c ext/opcache/tests/bug71127.phpt
| From: | Xinchen Hui | Date: | Thu, 17 Dec 2015 06:27:33 +0000 |
| Subject: | com php-src: Fixed bug #71127 (Define in auto_prepend_file is overwrite): NEWS ext/opcache/Optimizer/pass1 _5.c ext/opcache/tests/bug71127.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90311@lists.php.net to get a copy of this message | ||
Commit: 940c68b55d4241f9f34d4f71064f5f12a44e8d3d
Author: Xinchen Hui <laruence@gmail.com> Thu, 17 Dec 2015 14:27:33 +0800
Parents: ef9ddd0d82960d5c52f3abc00458c1eabdc149ec
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=940c68b55d4241f9f34d4f71064f5f12a44e8d3d
Log:
Fixed bug #71127 (Define in auto_prepend_file is overwrite)
Bugs:
https://bugs.php.net/71127
Changed paths:
M NEWS
M ext/opcache/Optimizer/pass1_5.c
A ext/opcache/tests/bug71127.phpt
Diff:
diff --git a/NEWS b/NEWS
index 99ec468..5f8c1c0 100644
--- 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)
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 1302e4b..f252117 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -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
index 0000000..78c5535
--- /dev/null
+++ b/ext/opcache/tests/bug71127.phpt
@@ -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