Browse Source

Don't strip leading zeros on floating point numbers

And fix the test case
PHP-5.2.1RC1
Rasmus Lerdorf 17 years ago
parent
commit
629eecbf7c
  1. 4
      ext/standard/strnatcmp.c
  2. 4
      ext/standard/tests/array/bug44929.phpt

4
ext/standard/strnatcmp.c

@ -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 */

4
ext/standard/tests/array/bug44929.phpt

@ -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]=>

Loading…
Cancel
Save