[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | ndossche | Date: | Fri, 02 Oct 2026 20:53:15 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141900@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-10-02T22:52:57+02:00
Commit: https://github.com/php/php-src/commit/1ab6d6b1bdca3edf715015c9920802a0577be803
Raw diff: https://github.com/php/php-src/commit/1ab6d6b1bdca3edf715015c9920802a0577be803.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix GH-23991: JIT generates invalid IR for multiple recursive calls
Changed paths:
A ext/opcache/tests/jit/gh23991.phpt
M NEWS
M ext/opcache/jit/zend_jit_ir.c
Diff:
diff --git a/NEWS b/NEWS
index f6f395444596..ee72be3bfaaf 100644
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,8 @@ PHP NEWS
single
-0.0 constant). (lazerg)
. Fixed crash when a file cache is reused with a different set of
extensions declaring frameless functions. (Ilia Alshanetsky)
+ . Fixed bug GH-23991 (JIT generates invalid IR for multiple recursive calls).
+ (ndossche)
- OpenSSL:
. Fixed stream_socket_enable_crypto() leaving the socket non-blocking
diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index 0198a7693a21..a360687563bb 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -10494,14 +10494,6 @@ static int zend_jit_do_fcall(zend_jit_ctx *jit, const zend_op *opline,
const zen
insn->inputs_count = 3;
insn->op3 = end;
break;
- } else if (insn->op == IR_LOOP_BEGIN && insn->inputs_count == 3) {
- ZEND_ASSERT(jit->ctx.ir_base[insn->op3].op == IR_LOOP_END);
- jit->ctx.ir_base[insn->op3].op = IR_END;
- ir_MERGE_2(insn->op3, ir_END());
- end = ir_LOOP_END();
- insn = &jit->ctx.ir_base[begin];
- insn->op3 = end;
- break;
}
}
/* fallback to indirect JMP or RETURN */
diff --git a/ext/opcache/tests/jit/gh23991.phpt b/ext/opcache/tests/jit/gh23991.phpt
new file mode 100644
index 000000000000..21c072793621
--- /dev/null
+++ b/ext/opcache/tests/jit/gh23991.phpt
@@ -0,0 +1,36 @@
+--TEST--
+GH-23991 (JIT generates invalid IR for multiple recursive calls converted into loop)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.jit_buffer_size=64M
+opcache.jit=1235
+opcache.jit_hot_func=1
+--EXTENSIONS--
+opcache
+--FILE--
+<?php
+function f($value, $recurse, $param = '') {
+ if (is_array($value)) {
+ if ($recurse) {
+ foreach ($value as $k => $v) {
+ $value[$k] = f($v, $recurse, $param);
+ }
+ }
+ foreach ($value as $k => $v) {
+ if ($undef) {
+ $value[$k] = f($v, $recurse, $param);
+ }
+ }
+ }
+ return $value;
+}
+var_dump(f([[]], true));
+?>
+--EXPECTF--
+Warning: Undefined variable $undef in %s on line %d
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}