iliaa Thu Sep 14 17:47:00 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/filter logical_filters.c
/php-src/ext/filter/tests bug7715.phpt
Log:
Make float filter handle things like 02.324 properly
http://cvs.php.net/viewvc.cgi/php-src/ext/filter/logical_filters.c?r1=1.1.2.7&r2=1.1.2.8&diff_format=u
Index: php-src/ext/filter/logical_filters.c
diff -u php-src/ext/filter/logical_filters.c:1.1.2.7
php-src/ext/filter/logical_filters.c:1.1.2.8
--- php-src/ext/filter/logical_filters.c:1.1.2.7 Thu Aug 31 18:29:29 2006
+++ php-src/ext/filter/logical_filters.c Thu Sep 14 17:46:59 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: logical_filters.c,v 1.1.2.7 2006/08/31 18:29:29 pajoye Exp $ */
+/* $Id: logical_filters.c,v 1.1.2.8 2006/09/14 17:46:59 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.1.2.1&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.1.2.1
--- 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:47:00 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