Skip to content

Commit e61e2c1

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix invalid target opline with jit->reuse_ip active (#16457)
2 parents 42e179e + 8b5668e commit e61e2c1

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8809,6 +8809,14 @@ jit_SET_EX_OPLINE(jit, opline);
88098809
delayed_call_chain = 1;
88108810
}
88118811

8812+
if (trace
8813+
&& trace->op == ZEND_JIT_TRACE_END
8814+
&& trace->stop >= ZEND_JIT_TRACE_STOP_INTERPRETER) {
8815+
if (!zend_jit_set_ip(jit, opline + 1)) {
8816+
return 0;
8817+
}
8818+
}
8819+
88128820
return 1;
88138821
}
88148822

@@ -9254,6 +9262,14 @@ static int zend_jit_init_static_method_call(zend_jit_ctx *jit,
92549262
delayed_call_chain = 1;
92559263
}
92569264

9265+
if (trace
9266+
&& trace->op == ZEND_JIT_TRACE_END
9267+
&& trace->stop >= ZEND_JIT_TRACE_STOP_INTERPRETER) {
9268+
if (!zend_jit_set_ip(jit, opline + 1)) {
9269+
return 0;
9270+
}
9271+
}
9272+
92579273
return 1;
92589274
}
92599275

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
JIT INIT_FCALL: 004 Invalid target opline with jit->reuse_ip active
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--EXTENSIONS--
7+
opcache
8+
--FILE--
9+
<?php
10+
11+
function gen() {
12+
yield 1;
13+
yield 2;
14+
return 3;
15+
};
16+
17+
opcache_jit_blacklist(gen(...));
18+
19+
for ($i = 0; $i < 2; ++$i) {
20+
foreach (gen() as $val) {
21+
var_dump($val);
22+
}
23+
}
24+
?>
25+
DONE
26+
--EXPECT--
27+
int(1)
28+
int(2)
29+
int(1)
30+
int(2)
31+
DONE

0 commit comments

Comments
 (0)