iliaa           Thu Sep 14 17:48:11 2006 UTC

  Modified files:              
    /php-src/ext/filter logical_filters.c 
    /php-src/ext/filter/tests   bug7715.phpt 
  Log:
  MFB: Make float filter handle things like 02.324 properly
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.8&r2=1.9&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.8 
php-src/ext/filter/logical_filters.c:1.9
--- php-src/ext/filter/logical_filters.c:1.8    Thu Aug 31 18:28:38 2006
+++ php-src/ext/filter/logical_filters.c        Thu Sep 14 17:48:11 2006
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: logical_filters.c,v 1.8 2006/08/31 18:28:38 pajoye Exp $ */
+/* $Id: logical_filters.c,v 1.9 2006/09/14 17:48:11 iliaa Exp $ */
 
 #include "php_filter.h"
 #include "filter_private.h"
@@ -332,9 +332,8 @@
 
        ret_val = 0.0;
 
-       if (*str == '0') {
-               /* leading zeros */
-               while (*(str++) == '0');
+       while (*str == '0') {
+               str++;
        }
 
        if (*str == dec_sep) {
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/tests/bug7715.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/filter/tests/bug7715.phpt
diff -u php-src/ext/filter/tests/bug7715.phpt:1.1 
php-src/ext/filter/tests/bug7715.phpt:1.2
--- php-src/ext/filter/tests/bug7715.phpt:1.1   Thu May 25 13:27:51 2006
+++ php-src/ext/filter/tests/bug7715.phpt       Thu Sep 14 17:48:11 2006
@@ -9,7 +9,8 @@
        '.4',
        '-.4',
        '1000000000000',
-       '-1000000000000'
+       '-1000000000000',
+       '02.324'
 );
 foreach ($data as $val) {
        $res = filter_data($val, FILTER_VALIDATE_FLOAT);
@@ -25,3 +26,4 @@
 float(-0.4)
 float(1.0E+12)
 float(-1.0E+12)
+float(2.324)

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

Reply via email to