[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Ilia Alshanetsky | Date: | Sat, 31 Oct 2026 13:31:43 +0000 |
| Subject: | [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143060@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-10-31T09:25:03-04:00
Commit: https://github.com/php/php-src/commit/1de9cb7beb77a37f45e0c27c5b1eedb9b4ccfbb0
Raw diff: https://github.com/php/php-src/commit/1de9cb7beb77a37f45e0c27c5b1eedb9b4ccfbb0.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
ext/opcache: Clear vacated MERGE inputs before conversion to BEGIN
Changed paths:
A ext/opcache/tests/jit/gh24397.phpt
M NEWS
M ext/opcache/jit/zend_jit_ir.c
Diff:
diff --git a/NEWS b/NEWS
index d764d7e175bd..f202f45ee500 100644
--- a/NEWS
+++ b/NEWS
@@ -112,6 +112,8 @@ PHP NEWS
cannot describe a parameter). (Ilia Alshanetsky)
- Opcache:
+ . Fixed bug GH-24397 (Assertion failure when dumping JIT IR).
+ (Ilia Alshanetsky)
. Fixed tracing JIT returning a wrapped integer instead of a float on
integer overflow after an integer was compared with a float or
numeric-string literal. (Ilia Alshanetsky)
diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c
index be3c7ad9bcbc..38f115d4e902 100644
--- a/ext/opcache/jit/zend_jit_ir.c
+++ b/ext/opcache/jit/zend_jit_ir.c
@@ -3658,6 +3658,11 @@ static void _zend_jit_fix_merges(zend_jit_ctx *jit)
if (k != n) {
ir_ref n2, k2;
+ /* BEGIN reads op2 as a label, so clear the vacated inputs */
+ while (r != q) {
+ *r = IR_UNUSED;
+ r++;
+ }
if (k <= 1) {
insn->op = IR_BEGIN;
insn->inputs_count = 0;
diff --git a/ext/opcache/tests/jit/gh24397.phpt b/ext/opcache/tests/jit/gh24397.phpt
new file mode 100644
index 000000000000..1ef87a66f3da
--- /dev/null
+++ b/ext/opcache/tests/jit/gh24397.phpt
@@ -0,0 +1,23 @@
+--TEST--
+GH-24397 (JIT: stale label operand on a MERGE reduced to BEGIN)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=64M
+opcache.jit=function
+opcache.jit_debug=0x1000000
+--EXTENSIONS--
+opcache
+--FILE--
+<?php
+function f() {
+ foreach ([1, 2] as $v) {
+ $c[] = $v;
+ }
+}
+f();
+echo "Done\n";
+?>
+--EXPECTF--
+%ADone