note 118846 added to filter.filters.validate
| From: | rihoj | Date: | Tue, 16 Feb 2016 00:09:20 +0000 |
| Subject: | note 118846 added to filter.filters.validate | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204949@lists.php.net to get a copy of this message | ||
The following code posted originally by Inigo has an issue with it.
echo filter_var(5, FILTER_VALIDATE_INT,array("options"
=>array('min_range'=>0,'max_range'=>4))) ? 'true'
:'false';
Because 0 is within the valid range, filter_var will return 0, but because of the Ternary operation
it will return false indicating it is not within the range when it is.
----
Server IP: 72.52.91.14
Probable Submitter: 66.244.106.233
----
Manual Page -- http://php.net/manual/en/filter.filters.validate.php
Edit -- https://master.php.net/note/edit/118846
Del: integrated -- https://master.php.net/note/delete/118846/integrated
Del: useless -- https://master.php.net/note/delete/118846/useless
Del: bad code -- https://master.php.net/note/delete/118846/bad+code
Del: spam -- https://master.php.net/note/delete/118846/spam
Del: non-english -- https://master.php.net/note/delete/118846/non-english
Del: in docs -- https://master.php.net/note/delete/118846/in+docs
Del: other reasons-- https://master.php.net/note/delete/118846
Reject -- https://master.php.net/note/reject/118846
Search -- https://master.php.net/manage/user-notes.php