Skip to content

Commit 650e59a

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-17428: Assertion failure ext/opcache/jit/zend_jit_ir.c:8940
2 parents a4e2583 + 3524702 commit 650e59a

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2760,8 +2760,8 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
27602760
/* THROW and EXIT may be used in the middle of BB */
27612761
/* don't generate code for the rest of BB */
27622762

2763-
/* Skip current opline for call_level computation
2764-
* Don't include last opline because end of loop already checks call level of last opline */
2763+
/* Skip current opline for call_level computation because it does not influence call_level.
2764+
* Don't include last opline because end of loop already checks call level of last opline. */
27652765
i++;
27662766
for (; i < end; i++) {
27672767
opline = op_array->opcodes + i;
@@ -2771,7 +2771,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
27712771
call_level--;
27722772
}
27732773
}
2774-
opline = op_array->opcodes + i;
2774+
opline = op_array->opcodes + end;
27752775
break;
27762776
/* stackless execution */
27772777
case ZEND_INCLUDE_OR_EVAL:

ext/opcache/tests/jit/gh17428.phpt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
--TEST--
2+
GH-17428 (Assertion failure ext/opcache/jit/zend_jit_ir.c:8940)
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.jit=1205
7+
--FILE--
8+
<?php
9+
new EmptyIterator();
10+
srand(1000);
11+
error_reporting(E_ALL);
12+
testConversion('', '');
13+
testConversion('', '');
14+
testConversion('', '');
15+
testConversion('', '');
16+
testConversion('', '');
17+
function testRoundTrip($data) {
18+
}
19+
for ($iterations = 0; $iterations < 100; $iterations++) {
20+
$strlen = rand(1, 100);
21+
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
22+
$randstring = '';
23+
for ($i = 0; $i < $strlen; $i++) {
24+
$randstring .= $characters[rand(0, strlen($characters) - 1)];
25+
}
26+
die($randstring);
27+
}
28+
echo "Done!\n";
29+
throw new Hello(new stdClass);
30+
?>
31+
--EXPECTF--
32+
Fatal error: Uncaught Error: Call to undefined function testConversion() in %s:%d
33+
Stack trace:
34+
#0 {main}
35+
thrown in %s on line %d

0 commit comments

Comments
 (0)