ID: 30298 User updated by: ross dot w at paradise dot net dot nz Reported By: ross dot w at paradise dot net dot nz -Status: Feedback +Status: Open Bug Type: Arrays related Operating System: Linux PHP Version: 4.3.8 New Comment:
After trying to find the problem I was unable to produce the problem without my usual includes, which includes stripping slashes from the $_POST variable. Indeed when I made a script with this one function (below) it had the same behaviour. I'm now no longer sure this is a bug, apologies for wasting your time. Here's the script, for reference: <?php $_POST = array_map('stripslashes',$_POST); if (!isset($HTTP_POST_VARS["test"])) { echo '<form action="'.$_SERVER["PHP_SELF"].'?hai=hai" method="post"><select multiple="multiple" size="5" name="test[]"><option name="o1">Option 1</option><option name="o2">Option 2</option><option name="o3">Option 3</option></select><br /><input type="submit" value="Go"></form>'; } else { echo 'These should all be identical<br />$_POST:<br />'; print_r($_POST["test"]); echo '<br />$HTTP_POST_VARS:<br />'; print_r($HTTP_POST_VARS["test"]); echo '<br />register globals:<br />'; print_r($test); } ?> Previous Comments: ------------------------------------------------------------------------ [2004-10-01 09:07:56] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-10-01 07:49:15] ross dot w at paradise dot net dot nz 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 this bug report at http://bugs.php.net/?id=30298&edit=1