1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +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:04:15 +00:00
parent 3ac8882dc1
commit 629eecbf7c
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -116,10 +116,10 @@ PHPAPI int strnatcmp_ex(char const *a, size_t a_len, char const *b, size_t b_len
ca = *ap; cb = *bp;
/* skip over leading spaces or zeros */
while (isspace((int)(unsigned char)ca) || (ca == '0' && ap+1 < aend))
while (isspace((int)(unsigned char)ca) || (ca == '0' && (ap+1 < aend) && (*(ap+1)!='.')))
ca = *++ap;
while (isspace((int)(unsigned char)cb) || (cb == '0' && bp+1 < bend))
while (isspace((int)(unsigned char)cb) || (cb == '0' && (bp+1 < bend) && (*(bp+1)!='.')))
cb = *++bp;
/* 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]=>