1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00

Don't strip leading zeros on floating point numbers

and fix the test case
This commit is contained in:
Rasmus Lerdorf
2009-04-09 16:08:34 +00:00
parent 775421e821
commit e965a7d95c
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -112,10 +112,10 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
ca = a[ai]; cb = b[bi];
/* skip over leading spaces or zeros */
while (isspace((int)(unsigned char)ca) || (ca == '0' && ai+1 < a_len))
while (isspace((int)(unsigned char)ca) || (ca == '0' && (ai+1 < a_len)) && (a[ai+1] != '.'))
ca = a[++ai];
while (isspace((int)(unsigned char)cb) || (cb == '0' && bi+1 < b_len))
while (isspace((int)(unsigned char)cb) || (cb == '0' && bi+1 < b_len) && (b[bi+1] != '.'))
cb = b[++bi];
/* process run of digits */
+2 -2
View File
@@ -10,12 +10,12 @@ var_dump($a);
array(10) {
[6]=>
string(4) "-123"
[7]=>
string(5) "0.002"
[8]=>
string(2) "00"
[9]=>
string(1) "0"
[7]=>
string(5) "0.002"
[0]=>
string(3) "001"
[4]=>