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

From: Date: Sun, 18 Oct 2026 09:13:12 +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-142388@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-18T11:13:00+02:00 Commit: https://github.com/php/php-src/commit/3f9f09e8037b334a0571820e0f24d3f88ef079f3 Raw diff: https://github.com/php/php-src/commit/3f9f09e8037b334a0571820e0f24d3f88ef079f3.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: Fix GH-24388: Tracing JIT segfault when a trace runs out of side exits Changed paths: A ext/opcache/tests/jit/gh24388.phpt M NEWS M ext/opcache/jit/zend_jit_ir.c Diff: diff --git a/NEWS b/NEWS index edc7b38d1027..49d1cb4e8054 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,8 @@ PHP NEWS . Fixed bug GH-24185 (Windows ZTS: random access violations with OPcache JIT in multi-process setups). (Arnaud, ndossche) . Fix SIGFPE on LONG_MIN % -1 with a constant divisor. (waroad) + . Fixed bug GH-24388 (Tracing JIT: segfault when a trace runs out of side + exits). (Lazizbek Ergashev) - PDO: . Fixed a duplicate warning when ATTR_STATEMENT_CLASS is rejected on a diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index 9036b16f0e28..3652fe0f64e4 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -4821,6 +4821,9 @@ static int zend_jit_inc_dec(zend_jit_ctx *jit, const zend_op *opline, uint32_t o exit_point = zend_jit_trace_get_exit_point(opline + 1, 0); exit_addr = zend_jit_trace_get_exit_addr(exit_point); + if (!exit_addr) { + return 0; + } ir_GUARD_NOT(ir_OVERFLOW(ref), ir_CONST_ADDR(exit_addr)); if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) && @@ -4862,6 +4865,9 @@ static int zend_jit_inc_dec(zend_jit_ctx *jit, const zend_op *opline, uint32_t o exit_point = zend_jit_trace_get_exit_point(opline + 1, 0); exit_addr = zend_jit_trace_get_exit_addr(exit_point); + if (!exit_addr) { + return 0; + } ir_GUARD(ir_OVERFLOW(ref), ir_CONST_ADDR(exit_addr)); if (opline->result_type != IS_UNUSED) { diff --git a/ext/opcache/tests/jit/gh24388.phpt b/ext/opcache/tests/jit/gh24388.phpt new file mode 100644 index 000000000000..7a73bb7fb3cf --- /dev/null +++ b/ext/opcache/tests/jit/gh24388.phpt @@ -0,0 +1,31 @@ +--TEST-- +GH-24388 (Tracing JIT: segfault when a trace runs out of side exits) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=64M +opcache.jit=tracing +--EXTENSIONS-- +opcache +--FILE-- +<?php +$file = __DIR__ . "/gh24388.inc"; + +$code = '<?php function f(int $k, int $a) { switch ($k) {'; +for ($i = 0; $i < 507; $i++) { + $code .= "case $i: \$l = $i; break;"; +} +$code .= '} return ++$a; }'; +$code .= 'for ($i = 0; $i < 200; $i++) { $a = 3; f(0, $a); }'; +file_put_contents($file, $code); + +include $file; +?> +DONE +--CLEAN-- +<?php +@unlink(__DIR__ . "/gh24388.inc"); +?> +--EXPECT-- +DONE

« previous php.cvs (#142388) next »