php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25262 Nested arrays in POST not processed correctly
Submitted: 2003-08-26 16:20 UTC Modified: 2003-08-26 16:35 UTC
From: jal at ambitonline dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.3 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jal at ambitonline dot com
New email:
PHP Version: OS:

 

 [2003-08-26 16:20 UTC] jal at ambitonline dot com
Description:
------------
Nested arrays in a HTML form are not parsed out correctly.

Reproduce code:
---------------
strtest1.php:

<form action="strtest2.php" method="post">
<input name="myObject[myVar]" size="40"><br>
<input name="myObject[myArray[0]]" size="40"><br>
<input name="myObject[myArray[1]]" size="40"><br>
<input type="submit" value="go">
</form>

strtest2.php:

<?php
  print_r($_POST);
?>

Expected result:
----------------
Array ( [myObject] => Array ( [myVar] => text1 myArray => Array([0] => text2 [1] => text3 ) ) )

Actual result:
--------------
Array ( [myObject] => Array ( [myVar] => text1 [myArray[0] => text2 [myArray[1] => text3 ) ) 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-26 16:31 UTC] pollita@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

The form you provided in reproduce code is invalid.  Please read the PHP net manual section on arrays again.

Try something like this:

<form action="strtest2.php" method="post">
<input name="myObject[myVar]" size="40"><br>
<input name="myObject[myArray][0]" size="40"><br>
<input name="myObject[myArray][1]" size="40"><br>
<input type="submit" value="go">
</form>

 [2003-08-26 16:35 UTC] jal at ambitonline dot com
DOH. Brain failure. Sorry.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 06:01:28 2024 UTC