#43097 [Opn->Bgs]: Filters are removing more characters than they should

From: Date: Wed, 21 Nov 2007 14:32:28 +0000
Subject: #43097 [Opn->Bgs]: Filters are removing more characters than they should
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-229@lists.php.net to get a copy of this message
ID: 43097 Updated by: vrana@php.net Reported By: john_judy at homedecorators dot com -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: FreeBSD and Windows XP SP2 PHP Version: 5.2.4 New Comment: Plus and minus signs are printed in monospace in opossit to fullstop. However I changed them to words. Array is documented by filter_var(): "Associative array of options or bitwise disjunction of flags. If filter accepts options, flags can be provided in "flags" field of array." Previous Comments: ------------------------------------------------------------------------ [2007-10-25 16:51:58] jani@php.net The docs need some work on these. Using dots where it might mean something else is not good idea. And some stuff isn't even documented. f.e. the array parameter. ------------------------------------------------------------------------ [2007-10-25 12:03:50] jani@php.net 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!) ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#229) next »