[php-src] master: Merge branch 'PHP-8.6'
| From: | Weilin Du | Date: | Mon, 16 Nov 2026 09:19:54 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143729@lists.php.net to get a copy of this message | ||
Author: Weilin Du (LamentXU123)
Date: 2026-11-16T17:14:51+08:00
Commit: https://github.com/php/php-src/commit/f5e5e3496649e32f37fa412d48fda204071e468a
Raw diff: https://github.com/php/php-src/commit/f5e5e3496649e32f37fa412d48fda204071e468a.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Merge branch 'PHP-8.5' into PHP-8.6
Changed paths:
A ext/standard/tests/versioning/gh25474.phpt
M ext/standard/versioning.c
Diff:
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 2a51f66449c0..ea1673f9cc5a 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 */