mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
JIT doesn't recognize that variables may be used after returning from a trace due to YIELD, so some effects may never be stored to memory. YIELD ops terminate trace recordings with ZEND_JIT_TRACE_STOP_RETURN, and are handled mostly like RETURN. Here I change zend_jit_trace_execute() so that YIELD terminates recordings with ZEND_JIT_TRACE_STOP_INTERPRETER instead, to ensure that we recognize that variables may be used after returning from the trace due to YIELD. Fixes GH-19493 Closes GH-19515
25 lines
364 B
PHP
25 lines
364 B
PHP
--TEST--
|
|
GH-19493 001: Var not stored before YIELD
|
|
--FILE--
|
|
<?php
|
|
|
|
function f() {
|
|
$offset = 0;
|
|
yield true;
|
|
for ($i = 0; $i < 100; $i++) {
|
|
$offset++;
|
|
if ($offset === 99) {
|
|
break;
|
|
}
|
|
yield true;
|
|
}
|
|
return $offset;
|
|
}
|
|
$gen = f();
|
|
foreach ($gen as $v) {}
|
|
var_dump($gen->getReturn());
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(99)
|