[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Weilin Du | Date: | Mon, 16 Nov 2026 09:19:53 +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-143730@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-16T17:12:11+08:00
Commit: https://github.com/php/php-src/commit/bba8d1f77161c4333834fa96ce68746a51a0ff3d
Raw diff: https://github.com/php/php-src/commit/bba8d1f77161c4333834fa96ce68746a51a0ff3d.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Merge branch 'PHP-8.4' into PHP-8.5
Changed paths:
A ext/standard/tests/versioning/gh25474.phpt
M NEWS
M ext/standard/versioning.c
Diff:
diff --git a/NEWS b/NEWS
index 8c61a73e3608..f367a11a3f04 100644
--- a/NEWS
+++ b/NEWS
@@ -136,6 +136,8 @@ PHP NEWS
(jorgsowa)
- Standard:
+ . Fixed bug GH-25474 (version_compare() treats large numeric parts as equal
+ on 64-bit Windows). (lazerg)
. Fixed bug GH-25387 (Uploaded files leak in request_parse_body()).
(Kévin Dunglas)
. Fixed uninitialized $errno in stream_socket_client() and fsockopen() for
diff --git a/ext/standard/tests/versioning/gh25474.phpt b/ext/standard/tests/versioning/gh25474.phpt
new file mode 100644
index 000000000000..c055b69d88bf
--- /dev/null
+++ b/ext/standard/tests/versioning/gh25474.phpt
@@ -0,0 +1,18 @@
+--TEST--
+GH-25474 (version_compare() treats numeric parts > 2147483647 as equal on Windows)
+--CREDITS--
+HFigarella
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+var_dump(version_compare('2147483648', '2147483647'));
+var_dump(version_compare('5000000000', '6000000000'));
+var_dump(version_compare('16.5-a.2-43779010004', '16.5-a.2-43192679404'));
+?>
+--EXPECT--
+int(1)
+int(-1)
+int(1)
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index dc7ca71af469..f08819bd2593 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -129,7 +129,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
char *ver1;
char *ver2;
char *p1, *p2, *n1, *n2;
- long l1, l2;
+ zend_long l1, l2;
int compare = 0;
if (!*orig_ver1 || !*orig_ver2) {
@@ -160,8 +160,8 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
}
if (isdigit((unsigned char)*p1) && isdigit((unsigned char)*p2)) {
/* compare element numerically */
- l1 = strtol(p1, NULL, 10);
- l2 = strtol(p2, NULL, 10);
+ l1 = ZEND_STRTOL(p1, NULL, 10);
+ l2 = ZEND_STRTOL(p2, NULL, 10);
compare = ZEND_NORMALIZE_BOOL(l1 - l2);
} else if (!isdigit((unsigned char)*p1) && !isdigit((unsigned char)*p2)) {
/* compare element names */