Skip to content

Commit f5e5e34

Browse files
committed
Merge branch 'PHP-8.6'
* PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
2 parents 46da0fd + bba8d1f commit f5e5e34

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-25474 (version_compare() treats numeric parts > 2147483647 as equal on Windows)
3+
--CREDITS--
4+
HFigarella
5+
--SKIPIF--
6+
<?php
7+
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
8+
?>
9+
--FILE--
10+
<?php
11+
var_dump(version_compare('2147483648', '2147483647'));
12+
var_dump(version_compare('5000000000', '6000000000'));
13+
var_dump(version_compare('16.5-a.2-43779010004', '16.5-a.2-43192679404'));
14+
?>
15+
--EXPECT--
16+
int(1)
17+
int(-1)
18+
int(1)

‎ext/standard/versioning.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
129129
char *ver1;
130130
char *ver2;
131131
char *p1, *p2, *n1, *n2;
132-
long l1, l2;
132+
zend_long l1, l2;
133133
int compare = 0;
134134

135135
if (!*orig_ver1 || !*orig_ver2) {
@@ -160,8 +160,8 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
160160
}
161161
if (isdigit((unsigned char)*p1) && isdigit((unsigned char)*p2)) {
162162
/* compare element numerically */
163-
l1 = strtol(p1, NULL, 10);
164-
l2 = strtol(p2, NULL, 10);
163+
l1 = ZEND_STRTOL(p1, NULL, 10);
164+
l2 = ZEND_STRTOL(p2, NULL, 10);
165165
compare = ZEND_NORMALIZE_BOOL(l1 - l2);
166166
} else if (!isdigit((unsigned char)*p1) && !isdigit((unsigned char)*p2)) {
167167
/* compare element names */

0 commit comments

Comments
 (0)