[php-src] master: Merge branch 'PHP-8.6'
| From: | Ilia Alshanetsky | Date: | Thu, 22 Oct 2026 16:42:59 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142586@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-10-22T12:24:55-04:00
Commit: https://github.com/php/php-src/commit/1e252384113403eb517cd9d18463c9571e5f18b2
Raw diff: https://github.com/php/php-src/commit/1e252384113403eb517cd9d18463c9571e5f18b2.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
ext/opcache: Fix tracing JIT range narrowing against a non-integer operand
Changed paths:
A ext/opcache/tests/jit/cmp_010.phpt
M ext/opcache/jit/zend_jit_trace.c
Diff:
diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index c7c10dfb44bc..8868f0e4f6e7 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -3736,7 +3736,7 @@ static void zend_jit_trace_update_condition_ranges(const zend_op *opline,
const
zend_long op1_min, op1_max, op2_min, op2_max;
if ((OP1_INFO() & MAY_BE_ANY) != MAY_BE_LONG
- || (OP1_INFO() & MAY_BE_ANY) != MAY_BE_LONG) {
+ || (OP2_INFO() & MAY_BE_ANY) != MAY_BE_LONG) {
return;
}
diff --git a/ext/opcache/tests/jit/cmp_010.phpt b/ext/opcache/tests/jit/cmp_010.phpt
new file mode 100644
index 000000000000..562e4e1d5d70
--- /dev/null
+++ b/ext/opcache/tests/jit/cmp_010.phpt
@@ -0,0 +1,57 @@
+--TEST--
+JIT CMP: 010 Integer range must not be narrowed by a comparison with a non-integer operand
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit=tracing
+opcache.jit_hot_func=1
+opcache.jit_hot_loop=1
+opcache.jit_hot_return=1
+opcache.jit_hot_side_exit=1
+--EXTENSIONS--
+opcache
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+function lt_float(int $x) {
+ if ($x < 1.0e19) {
+ return $x + 1;
+ }
+ return 0;
+}
+function lt_string(int $x) {
+ if ($x < "1e19") {
+ return $x + 1;
+ }
+ return 0;
+}
+function le_float(int $x) {
+ if ($x <= -1.0e19) {
+ return 0;
+ }
+ return $x - 1;
+}
+foreach ([1, 2, 3, PHP_INT_MAX] as $v) {
+ $r = lt_float($v);
+}
+echo "int < float: ";
+var_dump($r);
+foreach ([1, 2, 3, PHP_INT_MAX] as $v) {
+ $r = lt_string($v);
+}
+echo "int < numeric string: ";
+var_dump($r);
+foreach ([1, 2, 3, PHP_INT_MIN] as $v) {
+ $r = le_float($v);
+}
+echo "int <= float (false): ";
+var_dump($r);
+?>
+--EXPECT--
+int < float: float(9.223372036854776E+18)
+int < numeric string: float(9.223372036854776E+18)
+int <= float (false): float(-9.223372036854776E+18)