note 103824 deleted from function.filter-input by danbrown
| From: | danbrown@php.net | Date: | Thu, 05 May 2011 15:04:16 +0000 |
| Subject: | note 103824 deleted from function.filter-input by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179458@lists.php.net to get a copy of this message | ||
Note Submitter: henry at henrysmith dot org
----
Marques Johansson mentioned that this works:
<?php
$test = filter_input(INPUT_GET | INPUT_POST, 'test');
?>
I've just tested it and found that it doesn't:
<?php
// assume $_GET['a'] = 1
// assume $_POST['b'] = 2
// assume $_POST['c'] = 3
// assume $_POST['d'] = 4
$a = filter_input(INPUT_GET | INPUT_POST, 'a');
$b = filter_input(INPUT_GET | INPUT_POST, 'b');
$c = filter_input(INPUT_POST | INPUT_GET, 'c');
$d = filter_input(INPUT_POST, 'd');
var_dump($a); // string(1) "1"
var_dump($b); // NULL
var_dump($c); // NULL
var_dump($d); // string(1) "4"
?>
This seems quite unpredictable behaviour, I wouldn't recommend relying on this undocumented
functionality for anything.
For reference, my PHP version is "PHP 5.3.2-1ubuntu4.8 with Suhosin-Patch (cli) (built: Apr 27
2011 05:07:22)".