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

From: Date: Sun, 18 Oct 2026 08:59:38 +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-142380@lists.php.net to get a copy of this message
Author: ndossche (ndossche) Date: 2026-10-18T10:59:26+02:00 Commit: https://github.com/php/php-src/commit/f51616237a724cc166ad49c18b10699008f15fb4 Raw diff: https://github.com/php/php-src/commit/f51616237a724cc166ad49c18b10699008f15fb4.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: JIT: Fix SIGFPE on LONG_MIN % -1 with a constant divisor Changed paths: M NEWS M ext/opcache/jit/zend_jit_ir.c M ext/opcache/tests/jit/mod_002.phpt Diff: diff --git a/NEWS b/NEWS index 019718e5ca0c..edc7b38d1027 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,7 @@ PHP NEWS property). (Lazizbek Ergashev) . 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) - 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 63f6322e161d..9036b16f0e28 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -5826,6 +5826,9 @@ static int zend_jit_long_math_helper(zend_jit_ctx *jit, if (Z_MODE(res_addr) == IS_REG) { ref = ir_CONST_LONG(0); // dead code } + } else if (op2_lval == -1) { + /* Prevent overflow error/crash if op1 == LONG_MIN */ + ref = ir_CONST_LONG(0); } else if (zend_long_is_power_of_two(op2_lval) && op1_range && op1_range->min >= 0) { ref = ir_AND_L(jit_Z_LVAL(jit, op1_addr), ir_CONST_LONG(op2_lval - 1)); } else { diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt index a19d8c41ac38..175398a617a4 100644 --- a/ext/opcache/tests/jit/mod_002.phpt +++ b/ext/opcache/tests/jit/mod_002.phpt @@ -32,6 +32,7 @@ var_dump(modNeg33(125)); var_dump(modNeg33(-125)); try { var_dump(modNeg1(125)); + var_dump(modNeg1(PHP_INT_MIN)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } @@ -49,4 +50,5 @@ int(-29) int(26) int(-26) int(0) +int(0) DivisionByZeroError: Modulo by zero

« previous php.cvs (#142380) next »