|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51368 php_filter_float does not allow custom thousand separators
Submitted: 2010-03-23 18:50 UTC Modified: 2018-03-24 14:08 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mumu at seznam dot cz Assigned: cmb (profile)
Status: Closed Package: Filter related
PHP Version: 5.2.13 OS: N/A
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
25 - 20 = ?
Subscribe to this entry?

 [2010-03-23 18:50 UTC] mumu at seznam dot cz
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:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-28 19:50 UTC]
-Package: Unknown/Other Function +Package: Filter related
 [2018-03-24 14:08 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-03-24 14:08 UTC]
The PR has been merged – closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 16:01:33 2024 UTC