Skip to content

Commit c4aa851

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: JIT: Fix TSSA of ZEND_FE_FETCH_R with key operand
2 parents 9e3e41f + ef589ce commit c4aa851

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ PHP NEWS
99
. Fixed tracing JIT crash when a VM interrupt is handled during an observed
1010
user function call. (Levi Morrison)
1111
. Fixed bug GH-21746 (Segfault with tracing JIT). (Arnaud)
12+
. Fixed bug GH-22004 (Assertion failure at ext/opcache/jit/zend_jit_trace.c).
13+
(Arnaud)
1214

1315
- OpenSSL:
1416
. Fix compatibility issues with OpenSSL 4.0. (jordikroon, Remi)

ext/opcache/jit/zend_jit_trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,9 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
23462346
if (ssa_ops[idx].op2_use >= 0 && ssa_ops[idx].op2_def >= 0) {
23472347
ssa_var_info[ssa_ops[idx].op2_def] = ssa_var_info[ssa_ops[idx].op2_use];
23482348
}
2349+
if (ssa_ops[idx].result_use >= 0 && ssa_ops[idx].result_def >= 0) {
2350+
ssa_var_info[ssa_ops[idx].result_def] = ssa_var_info[ssa_ops[idx].result_use];
2351+
}
23492352
} else {
23502353
if (zend_update_type_info(op_array, tssa, script, (zend_op*)opline, ssa_ops + idx, ssa_opcodes, optimization_level) == FAILURE) {
23512354
// TODO:

ext/opcache/tests/jit/gh22004.phpt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--TEST--
2+
GH-22004: ZEND_FE_FETCH_R with key operand
3+
--CREDITS--
4+
YuanchengJiang
5+
--FILE--
6+
<?php
7+
8+
function doRandom($iter) {
9+
for ($i = 0; $i < $iter; $i++) {
10+
$lines = [];
11+
for ($j = 0; $j < $nLines; $j++) {
12+
$lines[] = $line;
13+
}
14+
foreach ($lines as $i => $line) {
15+
}
16+
}
17+
}
18+
$iter = 20;
19+
doRandom($iter);
20+
21+
?>
22+
==DONE==
23+
--EXPECTF--
24+
Warning: Undefined variable $nLines in %s on line %d
25+
26+
Warning: Undefined variable $nLines in %s on line %d
27+
28+
Warning: Undefined variable $nLines in %s on line %d
29+
30+
Warning: Undefined variable $nLines in %s on line %d
31+
32+
Warning: Undefined variable $nLines in %s on line %d
33+
34+
Warning: Undefined variable $nLines in %s on line %d
35+
36+
Warning: Undefined variable $nLines in %s on line %d
37+
38+
Warning: Undefined variable $nLines in %s on line %d
39+
40+
Warning: Undefined variable $nLines in %s on line %d
41+
42+
Warning: Undefined variable $nLines in %s on line %d
43+
44+
Warning: Undefined variable $nLines in %s on line %d
45+
46+
Warning: Undefined variable $nLines in %s on line %d
47+
48+
Warning: Undefined variable $nLines in %s on line %d
49+
50+
Warning: Undefined variable $nLines in %s on line %d
51+
52+
Warning: Undefined variable $nLines in %s on line %d
53+
54+
Warning: Undefined variable $nLines in %s on line %d
55+
56+
Warning: Undefined variable $nLines in %s on line %d
57+
58+
Warning: Undefined variable $nLines in %s on line %d
59+
60+
Warning: Undefined variable $nLines in %s on line %d
61+
62+
Warning: Undefined variable $nLines in %s on line %d
63+
==DONE==

0 commit comments

Comments
 (0)