[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Tue, 24 Nov 2026 18:56:58 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144125@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-11-24T19:56:44+01:00 Commit: https://github.com/php/php-src/commit/4fc0c7410292f58ef4c85a885308545a09d5e9ba Raw diff: https://github.com/php/php-src/commit/4fc0c7410292f58ef4c85a885308545a09d5e9ba.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: ext/opcache: Fix JIT register allocation for ASSIGN to traced reference Changed paths: A ext/opcache/tests/jit/assign_typed_ref_reg_001.phpt M NEWS M ext/opcache/jit/zend_jit_trace.c Diff: diff --git a/NEWS b/NEWS index 9ff52d626ae0..3923ea17479b 100644 --- a/NEWS +++ b/NEWS @@ -136,6 +136,7 @@ PHP NEWS an argument arrives as null). (Ilia Alshanetsky) . Fixed tracing JIT taking the wrong branch after a VM interrupt. (Brian Marks) + . Fix JIT register allocation for ASSIGN to traced reference. (ndossche) - OpenSSL: . Fixed bug GH-25172 (TLS session reuse shares request-lifetime callback diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 3ba3ae56b776..792fe76a0b43 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -2983,9 +2983,12 @@ static zend_jit_reg_var* zend_jit_trace_allocate_registers(zend_jit_trace_rec *t if (support_opline && opline->opcode == ZEND_ASSIGN && opline->op1_type == IS_CV - && ssa_op->op1_def >= 0 - && ssa->vars[ssa_op->op1_def].alias != NO_ALIAS) { - /* avoid register allocation in case of possibility of indirect modification*/ + && ((ssa_op->op1_def >= 0 + && ssa->vars[ssa_op->op1_def].alias != NO_ALIAS) + || (p->op1_type != IS_UNKNOWN + && (p->op1_type & IS_TRACE_REFERENCE)))) { + /* avoid register allocation in case of possibility of indirect modification + * or assignment through a (possibly typed) reference */ support_opline = false; } diff --git a/ext/opcache/tests/jit/assign_typed_ref_reg_001.phpt b/ext/opcache/tests/jit/assign_typed_ref_reg_001.phpt new file mode 100644 index 000000000000..bd9ccd6a765d --- /dev/null +++ b/ext/opcache/tests/jit/assign_typed_ref_reg_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +JIT ASSIGN: result must not be register-allocated when op1 is traced as a reference +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.jit=tracing +opcache.jit_buffer_size=64M +opcache.jit_hot_loop=1 +opcache.jit_hot_side_exit=1 +--EXTENSIONS-- +opcache +--FILE-- +<?php +function test() { + for ($i = 0; $i < 100; $i++) { + +$a = +$a .= $a + $a .= +$x; + $x = &$a + $x++; + } +} +try { + test(); +} catch (Throwable $e) { + echo $e::class, ": ", $e->getMessage(), "\n"; +} +?> +--EXPECTF-- +Warning: Undefined variable $x in %s on line %d + +Warning: Undefined variable $a in %s on line %d +%A +TypeError: Unsupported operand types: string + string

« previous php.cvs (#144125) next »