Skip to content

Commit e52d617

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fixed GH-12509: JIT assertion when running php-parser tests
2 parents f8433a5 + 770c1b0 commit e52d617

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,12 @@ static uint32_t get_ssa_alias_types(zend_ssa_alias_kind alias) {
17311731
} \
17321732
if (__var >= 0) { \
17331733
zend_ssa_var *__ssa_var = &ssa_vars[__var]; \
1734+
if (__ssa_var->var < op_array->num_args) { \
1735+
if (__type & MAY_BE_RC1) { \
1736+
/* TODO: may be captured by exception backtreace */ \
1737+
__type |= MAY_BE_RCN; \
1738+
} \
1739+
} \
17341740
if (__ssa_var->var < op_array->last_var) { \
17351741
if (__type & (MAY_BE_REF|MAY_BE_RCN)) { \
17361742
__type |= MAY_BE_RC1 | MAY_BE_RCN; \

ext/opcache/tests/jit/gh12509.phpt

Lines changed: 28 additions & 0 deletions
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)