#43097 [NEW]: Filters are removing more characters than they should
From: john_judy at homedecorators dot com
Operating system: Free BSD and Windows XP SP2
PHP version: 5.2.4
PHP Bug Type: Unknown/Other Function
Bug description: Filters are removing more characters than they should
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 bug report at http://bugs.php.net/?id=43097&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43097&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43097&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43097&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43097&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43097&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=43097&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43097&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43097&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43097&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43097&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43097&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=43097&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=43097&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43097&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43097&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43097&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43097&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43097&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43097&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43097&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43097&r=mysqlcfg
Thread (2 messages)
- john_judy at homedecorators dot com