Skip to content

Commit 5f46d86

Browse files
committed
Fixed GH-12509: JIT assertion when running php-parser tests
1 parent 27797a2 commit 5f46d86

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Zend/Optimizer/zend_inference.c

+6
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,12 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
17461746
} \
17471747
if (__var >= 0) { \
17481748
zend_ssa_var *__ssa_var = &ssa_vars[__var]; \
1749+
if (__ssa_var->var < op_array->num_args) { \
1750+
if (__type & MAY_BE_RC1) { \
1751+
/* TODO: may be captured by exception backtreace */ \
1752+
__type |= MAY_BE_RCN; \
1753+
} \
1754+
} \
17491755
if (__ssa_var->var < op_array->last_var) { \
17501756
if (__type & (MAY_BE_REF|MAY_BE_RCN)) { \
17511757
__type |= MAY_BE_RC1 | MAY_BE_RCN; \

ext/opcache/tests/jit/gh12509.phpt

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
GH-12509: JIT assertion when running php-parser tests
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--FILE--
7+
<?php
8+
function capture() {
9+
$GLOBALS["x"] = new Exception();
10+
}
11+
function test($a) {
12+
$a[1] = 1;
13+
$a[2] = 2;
14+
capture();
15+
$a[3] = 3;
16+
return $a;
17+
}
18+
var_dump(test([]));
19+
?>
20+
--EXPECT--
21+
array(3) {
22+
[1]=>
23+
int(1)
24+
[2]=>
25+
int(2)
26+
[3]=>
27+
int(3)
28+
}

0 commit comments

Comments
 (0)