|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57367 min_range and max_range options do not work for FILTER_VALIDATE_INT
Submitted: 2006-11-10 11:18 UTC Modified: 2006-11-10 11:35 UTC
From: Assigned:
Status: Not a bug Package: filter (PECL)
PHP Version: 5.2.0 OS: Mac OS X 10.4.8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2006-11-10 11:18 UTC]
When using FILTER_VALIDATE_INT, the min_range and max_range options seem to have no effect. The integer is returned, regardless.

Perhaps there is a problem with FETCH_LONG_OPTION() and even FETCH_STRING_OPTION() (as perhaps indicated by my comment on 2006-11-10 16:08 UTC here:

Reproduce code:

// $_GET['age'] = '0'
$age = 102;

$options = array('min_range' => 1, 'max_range' => 100);

var_dump(filter_input(INPUT_GET, 'age', FILTER_VALIDATE_INT, $options));

var_dump(filter_var($age, FILTER_VALIDATE_INT, $options));


Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-10 11:19 UTC]
Changing version from 5.2.0 RC4 to 5.2.0 (for some reason, the bug report form wouldn't allow me to use 5.2.0).
 [2006-11-10 11:35 UTC]
This is bogus because I was providing the options arguments incorrectly.

They should be passed like this:

array('options' => array('min_range' => 1, 'max_range' => 100))
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 09 05:03:34 2021 UTC