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:
@@ -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 */
|
||||
|
||||
@@ -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]=>
|
||||
|
||||
Reference in New Issue
Block a user