Edit report at https://bugs.php.net/bug.php?id=29401&edit=1

 ID:                 29401
 Comment by:         mikebianc at aol dot com
 Reported by:        xmlguy at hotmail dot com
 Summary:            Form POST not decoded properly
 Status:             Open
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   Win XP Pro
 PHP Version:        4.3.8
 Block user comment: N
 Private report:     N

 New Comment:

fwiw, python parses this properly.  I'm just seeing an empty array!

<form enctype="multipart/form-data" action='/fileupload.php' method=post> 
<input multiple=true type=file name='file["my{}stuff"].data'><input type=submit 
value='submit'></form>

var_dump($_FILES) yields:
array(0) {}

If I change the 'action' to a python script, I see this:
[ { 'file["my{}stuff"].data’, ‘testfile2.txt’, ‘this is another test 
file (2)\n’ }, { ‘file["my{}stuff"].data’, ‘testfile1.txt’, ‘this 
is test file 1\n’ } ] ]

POST source:
Content-Type: multipart/form-data; 
boundary=---------------------------141539390286251557952150290 Content-Length: 
468 -----------------------------141539390286251557952150290 
Content-Disposition: form-data; name="file[\"my{}stuff\"].data"; 
filename="testfile2.txt" Content-Type: text/plain this is another test file (2) 
-----------------------------141539390286251557952150290 Content-Disposition: 
form-data; name="file[\"my{}stuff\"].data"; filename="testfile1.txt" 
Content-Type: text/plain this is test file 1 
-----------------------------141539390286251557952150290--


Previous Comments:
------------------------------------------------------------------------
[2004-10-12 00:32:05] xmlguy at hotmail dot com

I indicated this as an mbstring related problem because the similar bugs I 
found used this as the category.

See bugs 20114 19507 19347 20024 20133.

------------------------------------------------------------------------
[2004-10-08 16:17:43] moriyo...@php.net

How come this could be a mbstring related problem..?

------------------------------------------------------------------------
[2004-07-27 02:44:23] xmlguy at hotmail dot com

with the version of the form I posted, the expected and actual result sample 
data should obviously reflect the strings "John" and "Doe" instead of "billy" 
and "joel", respectfully.

------------------------------------------------------------------------
[2004-07-27 02:33:53] xmlguy at hotmail dot com

Description:
------------
If key contains more than one set of square brackets, the key value pair is not 
decoded properly.  For example, a form with a series of input elements named 
such as "formname[0].fieldname[0]" will cause incorrect and missing key/value 
pairs to be stored into the $_POST array.

In researching the existing bug list, I noticed that there have been numerous 
variations of bugs reported when form data contains url encoded data, such as 
occurs when the brackets are encoded as %5b and %5d.  However these bugs have 
apparently been closed without actually fixing this problem.  Perhaps a more 
thorough analysis of this problem is warranted to keep it from lingering on for 
a few more years before this report is closed.  The Adobe acrobat 
products/reader have just started to encode form names in this format, so it 
could become a very serious issue if PHP cannot correctly process this form 
data. 

Reproduce code:
---------------
<html>
<head><title>Form Submit Test Script</title></head>
<body>
  <form name='fm1' action="<? echo ($_SERVER["HTTP_REFERER"])?>" method='post'>
    <input type='text' name='form1[0].firstname[0]' value='John' />
    <input type='text' name='form1[0].lastname[0]' value='Doe' />
    <input type='submit' />
  </form>
<?
var_dump($_POST);
?>

</body>
</html>

Expected result:
----------------
array(2) { ["form1[0].firstname[0]"]=> string(5) "billy" 
["form1[0].lastname[0]"]=> string(4) "joel" } 


Actual result:
--------------
array(1) { ["form1"]=> array(1) { [0]=> string(4) "joel" } }




------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=29401&edit=1

Reply via email to