#41110 [Opn->Bgs]: Filter extension doesn't allow GET/POST array parameters

From: Date: Tue, 17 Apr 2007 06:44:52 +0000
Subject: #41110 [Opn->Bgs]: Filter extension doesn't allow GET/POST array parameters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111582@lists.php.net to get a copy of this message
ID: 41110 Updated by: pajoye@php.net Reported By: mauroi at digbang dot com -Status: Open +Status: Bogus Bug Type: Filter related Operating System: Linux & Windows PHP Version: 5.2.1 -Assigned To: +Assigned To: pajoye New Comment: Use the FILTER_FORCE_ARRAY array. It allows array as input and always returns an array (skipping a pointless if (is_array($a)) test). Or use FILTER_REQUIRE_ARRAY if you expect an array. No bug > bogus. Previous Comments: ------------------------------------------------------------------------ [2007-04-17 02:51:21] mauroi at digbang dot com Description: ------------ I'm trying to use an old way of sending arrays between pages in PHP with the new filter extension. With normal superglobals if you append '[]' after a parameter's name, you get an array with one element for each aparence. Eg, http://localhost/foo.php?a[]=1&a[]=2 results in an array with two positions in $_GET['a']. I'm not being able to emulate this behavior with the filter extension. Reproduce code: --------------- <pre> <? var_dump($_GET['a']); var_dump(filter_input(INPUT_GET, 'a', FILTER_DEFAULT)) ?> </pre> Expected result: ---------------- array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } Actual result: -------------- array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41110&edit=1

« previous php.bugs (#111582) next »