[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | David Carlier | Date: | Wed, 11 Nov 2026 17:02:11 +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-143588@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-11T17:00:06Z
Commit: https://github.com/php/php-src/commit/d5a95c107457f6cb253a33c723303915c042eecd
Raw diff: https://github.com/php/php-src/commit/d5a95c107457f6cb253a33c723303915c042eecd.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix tracing JIT reading the int result of ++/-- on a reference as a double
Changed paths:
A ext/opcache/tests/jit/inc_025.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 a993b1c3cbea..b2b7afcdb8a2 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -4543,7 +4543,7 @@ static zend_vm_opcode_handler_t zend_jit_trace(zend_jit_trace_rec
*trace_buffer,
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
} else if (opline->result_type != IS_UNUSED
&& (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_DOUBLE|MAY_BE_GUARD)
- && !(res_info & MAY_BE_STRING)) {
+ && !(op1_info & MAY_BE_STRING)) {
ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD;
}
goto done;
diff --git a/ext/opcache/tests/jit/inc_025.phpt b/ext/opcache/tests/jit/inc_025.phpt
new file mode 100644
index 000000000000..c6dceb7ea8e9
--- /dev/null
+++ b/ext/opcache/tests/jit/inc_025.phpt
@@ -0,0 +1,43 @@
+--TEST--
+JIT INC: 025 (result type of ++/-- on a reference after the trace saw a float)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.protect_memory=1
+opcache.jit=tracing
+--EXTENSIONS--
+opcache
+--FILE--
+<?php
+function pre_inc($a) { $v = $a; $x = &$v; $out = []; for ($i = 0; $i < 4; $i++) { $out[] =
++$x; } return $out; }
+function post_inc($a) { $v = $a; $x = &$v; $out = []; for ($i = 0; $i < 4; $i++) { $out[] =
$x++; } return $out; }
+function pre_dec($a) { $v = $a; $x = &$v; $out = []; for ($i = 0; $i < 4; $i++) { $out[] =
--$x; } return $out; }
+function glob_inc($a) { global $g; $g = $a; $out = []; for ($i = 0; $i < 4; $i++) { $out[] =
++$g; } return $out; }
+function stat_inc($a) { static $s; $s = $a; $out = []; for ($i = 0; $i < 4; $i++) { $out[] =
++$s; } return $out; }
+
+class P { public float|string $t = ''; }
+function typed_ref_inc($a) {
+ $o = new P; $o->t = $a; $x = &$o->t; $out = [];
+ for ($i = 0; $i < 4; $i++) { $out[] = $x++; }
+ return $out;
+}
+
+foreach (['pre_inc', 'post_inc', 'pre_dec', 'glob_inc',
'stat_inc'] as $f) {
+ for ($n = 0; $n < 20; $n++) {
+ $f(1.5);
+ }
+ echo $f, ' ', json_encode($f(5)), "\n";
+}
+for ($n = 0; $n < 20; $n++) {
+ typed_ref_inc(1.5);
+}
+echo 'typed_ref_inc ', json_encode(typed_ref_inc("2.5")), "\n";
+?>
+--EXPECT--
+pre_inc [6,7,8,9]
+post_inc [5,6,7,8]
+pre_dec [4,3,2,1]
+glob_inc [6,7,8,9]
+stat_inc [6,7,8,9]
+typed_ref_inc ["2.5",3.5,4.5,5.5]