1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fit JIT variable not stored before YIELD
This commit is contained in:
Arnaud Le Blanc
2025-08-19 15:50:35 +02:00
4 changed files with 57 additions and 1 deletions

3
NEWS
View File

@@ -16,6 +16,9 @@ PHP NEWS
- ODBC:
. Remove ODBCVER and assume ODBC 3.5. (Calvin Buckley)
- Opcache:
. Fixed bug GH-19493 (JIT variable not stored before YIELD). (Arnaud)
- OpenSSL:
. Implement #81724 (openssl_cms_encrypt only allows specific ciphers).
(Jakub Zelenka)

View File

@@ -987,6 +987,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
break;
}
const zend_op *prev_opline = opline;
handler = ZEND_OP_TRACE_INFO(opline, offset)->call_handler;
#ifdef HAVE_GCC_GLOBAL_REGS
handler();
@@ -995,7 +996,11 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
opline = handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
if (UNEXPECTED(((uintptr_t)opline & ~ZEND_VM_ENTER_BIT) == 0)) {
#endif
stop = ZEND_JIT_TRACE_STOP_RETURN;
if (prev_opline->opcode == ZEND_YIELD || prev_opline->opcode == ZEND_YIELD_FROM) {
stop = ZEND_JIT_TRACE_STOP_INTERPRETER;
} else {
stop = ZEND_JIT_TRACE_STOP_RETURN;
}
opline = NULL;
halt = ZEND_JIT_TRACE_HALT;
break;

View File

@@ -0,0 +1,24 @@
--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)

View File

@@ -0,0 +1,24 @@
--TEST--
GH-19493 002: Var not stored before YIELD_FROM
--FILE--
<?php
function f() {
$offset = 0;
yield from [true];
for ($i = 0; $i < 100; $i++) {
$offset++;
if ($offset === 99) {
break;
}
yield from [true];
}
return $offset;
}
$gen = f();
foreach ($gen as $v) {}
var_dump($gen->getReturn());
?>
--EXPECT--
int(99)