#29401 [Opn]: Form POST not decoded properly

From: Date: Fri, 08 Oct 2004 14:17:44 +0000
Subject: #29401 [Opn]: Form POST not decoded properly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67287@lists.php.net to get a copy of this message
 ID:               29401
 Updated by:       moriyoshi@php.net
 Reported By:      xmlguy at hotmail dot com
 Status:           Open
-Bug Type:         mbstring related
+Bug Type:         Feature/Change Request
 Operating System: Win XP Pro
 PHP Version:      4.3.8
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[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 http://bugs.php.net/?id=29401&edit=1


Thread (7 messages)

« previous php.bugs (#67287) next »