Skip to content

Commit fbd1f1f

Browse files
committed
Merge branch 'master' of git.php.net:php-src
2 parents 460e2e6 + e5ea3f3 commit fbd1f1f

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,13 +1654,15 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
16541654
}
16551655
} else if (block->op2_to == block->ext_to) {
16561656
/* both goto the same one - it's JMP */
1657-
/* JMPZNZ(?,L,L) -> JMP(L) */
1658-
last_op->opcode = ZEND_JMP;
1659-
SET_UNUSED(last_op->op1);
1660-
SET_UNUSED(last_op->op2);
1661-
block->op1_to = block->op2_to;
1662-
block->op2_to = NULL;
1663-
block->ext_to = NULL;
1657+
if (!(last_op->op1_type & (IS_VAR|IS_TMP_VAR))) {
1658+
/* JMPZNZ(?,L,L) -> JMP(L) */
1659+
last_op->opcode = ZEND_JMP;
1660+
SET_UNUSED(last_op->op1);
1661+
SET_UNUSED(last_op->op2);
1662+
block->op1_to = block->op2_to;
1663+
block->op2_to = NULL;
1664+
block->ext_to = NULL;
1665+
}
16641666
} else if (block->op2_to == next) {
16651667
/* jumping to next on Z - can follow to it and jump only on NZ */
16661668
/* JMPZNZ(X,L1,L2) L1: -> JMPNZ(X,L2) */

ext/opcache/tests/bug695449.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #69549 (Memory leak with opcache.optimization_level=0xFFFFFFFF)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
<?php
11+
$a = array(true);
12+
if($a[0] && false) {
13+
echo 'test';
14+
}
15+
echo "ok\n";
16+
?>
17+
--EXPECT--
18+
ok

0 commit comments

Comments
 (0)