Req #54852 [NEW]: Add filter option to allow both arrays and scalars
| From: | phrisyen at yahoo dot com | Date: | Thu, 19 May 2011 03:27:17 +0000 |
| Subject: | Req #54852 [NEW]: Add filter option to allow both arrays and scalars | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160824@lists.php.net to get a copy of this message | ||
From:
Operating system: *
PHP version: Irrelevant
Package: Filter related
Bug Type: Feature/Change Request
Bug description:Add filter option to allow both arrays and scalars
Description:
------------
This is a request for adding another flag (FILTER_FLAG_ALLOW_ARRAY) to
filter extension to allow both arrays and scalars for input, while
retaining their type (as opposed to FILTER_FORCE_ARRAY, which can accept
scalars, but will return an array).
So if input is array, return an array, and if scalar, return scalar.
It seems pretty basic.
Test script:
---------------
$test = filter_input(INPUT_GET, "a", FILTER_VALIDATE_INT,
FILTER_FLAG_ALLOW_ARRAY);
var_dump($test);
Expected result:
----------------
test.php?a=1
int(1)
test.php?a[]=1&a[]=2
array (2) { [0] => int(1), [1] => int(2) }
Actual result:
--------------
FILTER_FLAG_ALLOW_ARRAY not implemented ;)
--
Edit bug report at http://bugs.php.net/bug.php?id=54852&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54852&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54852&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54852&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54852&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54852&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54852&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54852&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54852&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54852&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54852&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54852&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54852&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54852&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54852&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54852&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54852&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54852&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54852&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54852&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54852&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54852&r=mysqlcfg