note 112452 added to function.filter-var
| From: | drew_mirage at hotmail dot com | Date: | Tue, 18 Jun 2013 19:14:18 +0000 |
| Subject: | note 112452 added to function.filter-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195263@lists.php.net to get a copy of this message | ||
One key thing to remember about filtering integers is that the value for the option max_range must
be less than or equal to the value of PHP_INT_MAX.
filter_var($someVariable, FILTER_VALIDATE_INT, array('options' =>
array('min_range' => 1, 'max_range' =>
SOME_VALUE_GREATER_THAN_PHP_INT_MAX)));
This will fail even if $someVariable is a valid integer in the expected range.
This can show up when you are attempting to validate a potential key for an unsigned MySQL INT type
(whose maximum value is 4294967295) on a 32-bit system, where the value of PHP_INT_MAX is
2147483647.
----
Server IP: 69.147.83.199
Probable Submitter: 108.172.101.141
----
Manual Page -- http://php.net/manual/en/function.filter-var.php
Edit -- https://master.php.net/note/edit/112452
Del: integrated -- https://master.php.net/note/delete/112452/integrated
Del: useless -- https://master.php.net/note/delete/112452/useless
Del: bad code -- https://master.php.net/note/delete/112452/bad+code
Del: spam -- https://master.php.net/note/delete/112452/spam
Del: non-english -- https://master.php.net/note/delete/112452/non-english
Del: in docs -- https://master.php.net/note/delete/112452/in+docs
Del: other reasons-- https://master.php.net/note/delete/112452
Reject -- https://master.php.net/note/reject/112452
Search -- https://master.php.net/manage/user-notes.php