note 115858 added to function.filter-input

From: Date: Sat, 04 Oct 2014 04:14:07 +0000
Subject: note 115858 added to function.filter-input
Groups: php.notes 
Request: Send a blank email to php-notes+get-200585@lists.php.net to get a copy of this message
filter_input() does not seem to support multiple values for a single variable name. Here is the code comparing the behavior of bare $_GET superglobal vs filter_input(INPUT_GET,...): <?php print("Bare \$_GET:\n"); var_dump($_GET); print("filter_input():\n"); var_dump(filter_input(INPUT_GET,"var")); ?> When calling: /..../script.php?var=123 (there is only one value for variable 'var') Output is: Bare $_GET: array(1) { ["var"]=> string(3) "123" } filter_input(): string(3) "123" When calling: /..../script.php?var[]=123&var[]=999 (there are two values for variable 'var') Output is: Bare $_GET: array(1) { ["var"]=> array(2) { [0]=> string(3) "123" [1]=> string(3) "999" } } filter_input(): bool(false) As expected, $_GET['var'] became an array. But filter_input() seems to be unable to process multiple values and returns false. ---- Server IP: 72.55.140.6 Probable Submitter: 24.203.218.23 ---- Manual Page -- http://php.net/manual/en/function.filter-input.php Edit -- https://master.php.net/note/edit/115858 Del: integrated -- https://master.php.net/note/delete/115858/integrated Del: useless -- https://master.php.net/note/delete/115858/useless Del: bad code -- https://master.php.net/note/delete/115858/bad+code Del: spam -- https://master.php.net/note/delete/115858/spam Del: non-english -- https://master.php.net/note/delete/115858/non-english Del: in docs -- https://master.php.net/note/delete/115858/in+docs Del: other reasons-- https://master.php.net/note/delete/115858 Reject -- https://master.php.net/note/reject/115858 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200585) next »