summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-05-07 12:14:14 +0300
committerDmitry Stogov <dmitry@zend.com>2015-05-07 12:14:14 +0300
commit8026001943109dea3f908b8dd0720a0de9781af6 (patch)
tree599ef4c705e006c772f6aeab58123c7f6b2031fe /ext/opcache
parent33e2aa452d5b1c46e7b362450233a9fd84036cc9 (diff)
downloadphp-git-8026001943109dea3f908b8dd0720a0de9781af6.tar.gz
Fixed bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF)
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/Optimizer/block_pass.c16
-rw-r--r--ext/opcache/tests/bug695449.phpt18
2 files changed, 27 insertions, 7 deletions
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index bbdddec750..d0e3ddfa82 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -1759,13 +1759,15 @@ next_target_ex:
}
} else if (block->op2_to == block->ext_to) {
/* both goto the same one - it's JMP */
- /* JMPZNZ(?,L,L) -> JMP(L) */
- last_op->opcode = ZEND_JMP;
- SET_UNUSED(last_op->op1);
- SET_UNUSED(last_op->op2);
- block->op1_to = block->op2_to;
- block->op2_to = NULL;
- block->ext_to = NULL;
+ if (!(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
+ /* JMPZNZ(?,L,L) -> JMP(L) */
+ last_op->opcode = ZEND_JMP;
+ SET_UNUSED(last_op->op1);
+ SET_UNUSED(last_op->op2);
+ block->op1_to = block->op2_to;
+ block->op2_to = NULL;
+ block->ext_to = NULL;
+ }
} else if (block->op2_to == next) {
/* jumping to next on Z - can follow to it and jump only on NZ */
/* JMPZNZ(X,L1,L2) L1: -> JMPNZ(X,L2) */
diff --git a/ext/opcache/tests/bug695449.phpt b/ext/opcache/tests/bug695449.phpt
new file mode 100644
index 0000000000..53a143a229
--- /dev/null
+++ b/ext/opcache/tests/bug695449.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$a = array(true);
+if($a[0] && false) {
+ echo 'test';
+}
+echo "ok\n";
+?>
+--EXPECT--
+ok