]> granicus.if.org Git - php/commitdiff
Fixed bug #66440 (Optimisation of conditional JMPs based on pre-evaluate constant...
authorDmitry Stogov <dmitry@zend.com>
Mon, 13 Jan 2014 12:16:23 +0000 (16:16 +0400)
committerDmitry Stogov <dmitry@zend.com>
Mon, 13 Jan 2014 12:16:23 +0000 (16:16 +0400)
ext/opcache/Optimizer/pass1_5.c
ext/opcache/tests/bug66440.phpt [new file with mode: 0644]

index 8f76c63d96694fc66b848904d2b929d51b8dccdc..577d1b66098e469fc5d804f40619334ddada157b 100644 (file)
@@ -433,7 +433,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                        zval t;
                                        
                                        if (zend_get_persistent_constant(Z_STRVAL(ZEND_OP1_LITERAL(opline - 1)),
-                                               Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)), &t, 0 TSRMLS_CC)) {
+                                               Z_STRLEN(ZEND_OP1_LITERAL(opline - 1)), &t, 1 TSRMLS_CC)) {
                                                if (replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
                                                        literal_dtor(&ZEND_OP1_LITERAL(opline - 1));
                                                        MAKE_NOP((opline - 1));
diff --git a/ext/opcache/tests/bug66440.phpt b/ext/opcache/tests/bug66440.phpt
new file mode 100644 (file)
index 0000000..b546e32
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Bug #66440 (Optimisation of conditional JMPs based on pre-evaluate constant function calls)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.file_update_protection=0
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+if(constant('PHP_BINARY')) {
+       echo "OK\n";
+}
+--EXPECT--
+OK