Skip to content

Commit 6ea870f

Browse files
committed
Fix bug #80184
1 parent 4982964 commit 6ea870f

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PHP NEWS
66
. Fixed bug #80121 (Null pointer deref if CurlHandle directly instantiated).
77
(Nikita)
88

9+
- Opcache:
10+
. Fixed bug #80184 (Complex expression in while / if statements resolves to
11+
false incorrectly). (Nikita)
12+
913
- SPL:
1014
. Fixed bug #65387 (Circular references in SPL iterators are not garbage
1115
collected). (Nikita)

Zend/tests/bug80184.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #80184: Complex expression in while / if statements resolves to false incorrectly
3+
--FILE--
4+
<?php
5+
6+
$callbacks = [
7+
function () { echo "First item!\n"; },
8+
function () { echo "Second item!\n"; },
9+
function () { echo "Third item!\n"; },
10+
function () { echo "Fourth item!\n"; },
11+
];
12+
13+
while ($callback = array_shift($callbacks) and ($callback() || true));
14+
15+
?>
16+
--EXPECT--
17+
First item!
18+
Second item!
19+
Third item!
20+
Fourth item!

ext/opcache/Optimizer/block_pass.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,7 @@ static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_arr
13711371
MAKE_NOP(last_op);
13721372
block->len--;
13731373
}
1374+
block->successors[0] = follow_block - cfg->blocks;
13741375
block->successors_count = 1;
13751376
++(*opt_count);
13761377
break;

0 commit comments

Comments
 (0)