#30298 [NEW]: $_POST variable not handling arrays properly
| From: | ross dot w at paradise dot net dot nz | Date: | Fri, 01 Oct 2004 05:49:19 +0000 |
| Subject: | #30298 [NEW]: $_POST variable not handling arrays properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-66969@lists.php.net to get a copy of this message | ||
From: ross dot w at paradise dot net dot nz
Operating system: Linux
PHP version: 4.3.8
PHP Bug Type: Arrays related
Bug description: $_POST variable not handling arrays properly
Description:
------------
The $_POST variable does not return an array (eg. from a select multiple
box) but instead returns the word "Array". $HTTP_POST_VARS and register
globals do not have this problem.
Reproduce code:
---------------
<select multiple="multiple" name="test[]">
<option name="o1">Option 1</option>
<option name="o2">Option 2</option>
<option name="o3">Option 3</option>
</select>
User selects some of these and clicks Submit
Expected result:
----------------
I would expect that these three cases should be equal on the PHP receiving
side:
$arr = $_POST["test"];
$arr = $HTTP_POST_VARS["test"];
$arr = $test;
(On systems with register globals)
Actual result:
--------------
Instead:
$arr = $_POST["test"];
$arr is a string with the word "Array" (incorrect)
$arr = $HTTP_POST_VARS["test"];
$arr is the array of selected items (correct)
$arr = $test;
On systems with register globals, $arr is the array of selected items
(correct)
--
Edit bug report at http://bugs.php.net/?id=30298&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30298&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30298&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30298&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30298&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30298&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30298&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30298&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30298&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30298&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30298&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30298&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30298&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30298&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30298&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30298&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30298&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30298&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30298&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30298&r=mysqlcfg