]> granicus.if.org Git - php/commitdiff
Improved fix for #71127
authorXinchen Hui <laruence@gmail.com>
Fri, 18 Dec 2015 09:37:40 +0000 (17:37 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 18 Dec 2015 09:37:40 +0000 (17:37 +0800)
ext/opcache/Optimizer/pass1_5.c
ext/opcache/Optimizer/zend_optimizer.h
ext/opcache/tests/bug71127.phpt

index f252117de74af7a6c9e2598befaccb0e533ccac9..4229f13ebeb4ddfa8d92754ae5093b5b3dd6cc36 100644 (file)
@@ -16,9 +16,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
        int i = 0;
        zend_op *opline = op_array->opcodes;
        zend_op *end = opline + op_array->last;
-       /* bug #71127*
-        zend_bool collect_constants = (op_array == &script->main_op_array); */
-       zend_bool collect_constants = 0;
+       zend_bool collect_constants = (ZEND_OPTIMIZER_PASS_15 & OPTIMIZATION_LEVEL)?
+               (op_array == &script->main_op_array) : 0;
 
        while (opline < end) {
                switch (opline->opcode) {
index fc6ec4357dda7f425b12a93c54402f5add3e5321..f4e441790f6a9446da896ff86c002cfd67390e8b 100644 (file)
 #define ZEND_OPTIMIZER_PASS_12         (1<<11)
 #define ZEND_OPTIMIZER_PASS_13         (1<<12)
 #define ZEND_OPTIMIZER_PASS_14         (1<<13)
+#define ZEND_OPTIMIZER_PASS_15         (1<<14)  /* Collect constants */
 
 #define ZEND_OPTIMIZER_ALL_PASSES      0xFFFFFFFF
 
-#define DEFAULT_OPTIMIZATION_LEVEL  "0xFFFFFFFF"
+#define DEFAULT_OPTIMIZATION_LEVEL  "0xFFFFBFFF"
 
 #endif
index 78c5535062cf31386653e5e42968972ea9bb47d4..5770aea1fb37f64fda9edf50e50f530aba6cadf2 100644 (file)
@@ -3,6 +3,7 @@ Bug #71127 (Define in auto_prepend_file is overwrite)
 --INI--
 opcache.enable=1
 opcache.enable_cli=1
+opcache.optimization_level=0xFFFFBFFF
 --SKIPIF--
 <?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
 --FILE--