Skip to content

Commit 081bf04

Browse files
committed
Merge branch 'PHP-8.6'
* PHP-8.6: Fix OSS-Fuzz #588264417
2 parents 23970fa + 7ce005b commit 081bf04

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

‎ext/opcache/jit/zend_jit_ir.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6719,7 +6719,9 @@ static int zend_jit_assign_to_variable(zend_jit_ctx *jit,
67196719
if (res_inputs->count == 1) {
67206720
phi = res_inputs->refs[0];
67216721
} else {
6722-
phi = ir_PHI_N((var_def_info & MAY_BE_LONG & MAY_BE_LONG) ? IR_LONG : IR_DOUBLE,
6722+
/* var_def_info may be ANY (e.g. ASSIGN_DIM) so use the fact that phi inputs must be the same type,
6723+
* and therefore use the type of the incoming values. */
6724+
phi = ir_PHI_N(jit->ctx.ir_base[res_inputs->refs[0]].type,
67236725
res_inputs->count, res_inputs->refs);
67246726
}
67256727
if (Z_MODE(var_addr) == IS_REG) {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: result in double register with multiple assignment paths
3+
--EXTENSIONS--
4+
opcache
5+
--INI--
6+
opcache.enable=1
7+
opcache.enable_cli=1
8+
opcache.jit=function
9+
--FILE--
10+
<?php
11+
12+
function f($k) {
13+
$x = [];
14+
for ($i = 0; $i < 3; $i++) {
15+
$a + $x[] = $k;
16+
$a = $b = $a = $x[$k . $k] = 0.5;
17+
}
18+
var_dump($a, $b);
19+
}
20+
21+
f("1");
22+
23+
?>
24+
--EXPECTF--
25+
Warning: Undefined variable $a in %s on line %d
26+
float(0.5)
27+
float(0.5)

0 commit comments

Comments
 (0)