[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard strnatcmp.c /ext/standard/tests/array bug44929.phpt

2009-04-09 Thread Rasmus Lerdorf
rasmus  Thu Apr  9 16:04:15 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   strnatcmp.c 
/php-src/ext/standard/tests/array   bug44929.phpt 
  Log:
  Don't strip leading zeros on floating point numbers
  And fix the test case
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/strnatcmp.c?r1=1.10.6.1&r2=1.10.6.2&diff_format=u
Index: php-src/ext/standard/strnatcmp.c
diff -u php-src/ext/standard/strnatcmp.c:1.10.6.1 
php-src/ext/standard/strnatcmp.c:1.10.6.2
--- php-src/ext/standard/strnatcmp.c:1.10.6.1   Wed Apr  8 18:16:06 2009
+++ php-src/ext/standard/strnatcmp.cThu Apr  9 16:04:15 2009
@@ -38,7 +38,7 @@
 
 #if 0
 static char const *version UNUSED =
-"$Id: strnatcmp.c,v 1.10.6.1 2009/04/08 18:16:06 rasmus Exp $";
+"$Id: strnatcmp.c,v 1.10.6.2 2009/04/09 16:04:15 rasmus Exp $";
 #endif
 /* {{{ compare_right
  */
@@ -116,10 +116,10 @@
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 */
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug44929.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/ext/standard/tests/array/bug44929.phpt
diff -u php-src/ext/standard/tests/array/bug44929.phpt:1.1.4.2 
php-src/ext/standard/tests/array/bug44929.phpt:1.1.4.3
--- php-src/ext/standard/tests/array/bug44929.phpt:1.1.4.2  Wed Apr  8 
18:16:06 2009
+++ php-src/ext/standard/tests/array/bug44929.phpt  Thu Apr  9 16:04:15 2009
@@ -10,12 +10,12 @@
 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]=>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard strnatcmp.c /ext/standard/tests/array bug44929.phpt

2009-04-08 Thread Rasmus Lerdorf
rasmus  Wed Apr  8 18:16:06 2009 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   bug44929.phpt 

  Modified files:  
/php-src/ext/standard   strnatcmp.c 
  Log:
  Fixed bug #44929 - Better handling of leading zeros
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/strnatcmp.c?r1=1.10&r2=1.10.6.1&diff_format=u
Index: php-src/ext/standard/strnatcmp.c
diff -u php-src/ext/standard/strnatcmp.c:1.10 
php-src/ext/standard/strnatcmp.c:1.10.6.1
--- php-src/ext/standard/strnatcmp.c:1.10   Thu Jul 15 01:26:03 2004
+++ php-src/ext/standard/strnatcmp.cWed Apr  8 18:16:06 2009
@@ -38,7 +38,7 @@
 
 #if 0
 static char const *version UNUSED =
-"$Id: strnatcmp.c,v 1.10 2004/07/15 01:26:03 iliaa Exp $";
+"$Id: strnatcmp.c,v 1.10.6.1 2009/04/08 18:16:06 rasmus Exp $";
 #endif
 /* {{{ compare_right
  */
@@ -116,10 +116,10 @@
ca = *ap; cb = *bp;
 
/* skip over leading spaces or zeros */
-   while (isspace((int)(unsigned char)ca))
+   while (isspace((int)(unsigned char)ca) || (ca == '0' && ap+1 < 
aend))
ca = *++ap;
 
-   while (isspace((int)(unsigned char)cb))
+   while (isspace((int)(unsigned char)cb) || (cb == '0' && bp+1 < 
bend))
cb = *++bp;
 
/* process run of digits */

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug44929.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/bug44929.phpt
+++ php-src/ext/standard/tests/array/bug44929.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php