Req #51368 [Opn]: php_filter_float does not allow custom thousand separators
| From: | cmb@php.net | Date: | Sun, 11 Mar 2018 12:17:56 +0000 |
| Subject: | Req #51368 [Opn]: php_filter_float does not allow custom thousand separators | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214282@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51368&edit=1
ID: 51368
Updated by: cmb@php.net
Reported by: mumu at seznam dot cz
Summary: php_filter_float does not allow custom thousand
separators
Status: Open
Type: Feature/Change Request
Package: Filter related
Operating System: N/A
PHP Version: 5.2.13
Block user comment: N
Private report: N
New Comment:
PR: <https://github.com/php/php-src/pull/3181>
Previous Comments:
------------------------------------------------------------------------
[2010-03-23 18:50:09] mumu at seznam dot cz
Description:
------------
The php_filter_float function located in /[svn]/php/php-src/trunk/ext/filter/logical_filters.c does
not allow setting custom thousand separators - the function always uses built-in set of three
separators provided in the tsd_sep[3] local variable, currently ",.'" (without double
quotes).
As a result, the function is not usable in countries which uses other char as a thousand separator,
for example " ". Additionally, it does not allow to prohibit separators some of the
separators.
Please add support for setting custom thousand separators which will override the one built-in in
the source code.
Test script:
---------------
var_dump(filter_var('1 000', FILTER_VALIDATE_FLOAT, array('flags' =>
FILTER_FLAG_ALLOW_THOUSAND, 'options' => array('thousand' => '
'))));
Expected result:
----------------
float(1000)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51368&edit=1