php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51370 php_filter_int does not allow thousand separators
Submitted: 2010-03-23 18:55 UTC Modified: 2018-03-12 14:16 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mumu at seznam dot cz Assigned:
Status: Open 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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
38 + 41 = ?
Subscribe to this entry?

 
 [2010-03-23 18:55 UTC] mumu at seznam dot cz
Description:
------------
The php_filter_int function located in /[svn]/php/php-src/trunk/ext/filter/logical_filters.c does not allow thousand separators in the provided value to valide.

Most countries allows using of thousand separators, so if the function is not usable in validating user input.

Please provide support for thousand separators in the sense of FILTER_FLAG_ALLOW_THOUSAND flag for php_filter_float function and Request #51368. 

Test script:
---------------
var_dump(filter_var('1 000', FILTER_VALIDATE_INT, array('flags' => FILTER_FLAG_ALLOW_THOUSAND, 'options' => array('thousand' => ' '))));

Expected result:
----------------
int(1000)

Actual result:
--------------
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-12 14:16 UTC] cmb@php.net
-Package: Unknown/Other Function +Package: Filter related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Aug 25 22:01:26 2019 UTC