ID: 43097
Updated by: [EMAIL PROTECTED]
Reported By: john_judy at homedecorators dot com
-Status: Open
+Status: Bogus
Bug Type: Filter related
Operating System: FreeBSD and Windows XP SP2
PHP Version: 5.2.4
New Comment:
>From the friendly manual:
"
options
Associative array of options or bitwise disjunction of flags. If filter
accepts options, flags can be provided in "flags" field of array. For
the "callback" filter, callback type should be passed.
"
echo filter_var($test,FILTER_SANITIZE_NUMBER_FLOAT,
array("flags" => FILTER_FLAG_ALLOW_FRACTION))."\n";
And about FILTER_SANITIZE_NUMBER_INT:
"Remove all characters except digits and +-."
(the dot in that sentence is NOT the decimal dot!)
Previous Comments:
------------------------------------------------------------------------
[2007-10-24 16:40:06] john_judy at homedecorators dot com
Description:
------------
When running the filters FILTER_SANITIZE_NUMBER_INT or
FILTER_SANITIZE_NUMBER_FLOAT, decimal points are being removed.
The filter information from phpinfo() (run on our FreeBSD machine which
still has 5.2.3, although this bug happens on PHP version 5.2.4 in
Windows XP also) is as follows:
filter
Input Validation and Filtering enabled
Revision $Revision: 1.74 $
Directive Local Value Master Value
filter.default unsafe_raw unsafe_raw
filter.default_flags no value no value
Reproduce code:
---------------
<?php
$test = "456.78";
echo $test."\n";
echo filter_var($test,FILTER_SANITIZE_NUMBER_INT)."\n";
echo filter_var($test,FILTER_SANITIZE_NUMBER_FLOAT,
array(FILTER_FLAG_ALLOW_FRACTION))."\n";
?>
Expected result:
----------------
456.78
456.78
456.78
Actual result:
--------------
456.78
45678
45678
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43097&edit=1