|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-11-10 11:18 UTC] ramsey@php.net
Description: ------------ 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: http://pecl.php.net/bugs/bug.php?id=5975). Reproduce code: --------------- <?php // $_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: ---------------- bool(false) bool(false) Actual result: -------------- int(0) int(102) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 01:00:02 2025 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))