From: xmlguy at hotmail dot com Operating system: Win XP Pro PHP version: 4.3.8 PHP Bug Type: mbstring related Bug description: Form POST not decoded properly
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 bug report at http://bugs.php.net/?id=29401&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29401&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29401&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29401&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29401&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29401&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29401&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29401&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29401&r=support Expected behavior: http://bugs.php.net/fix.php?id=29401&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29401&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29401&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29401&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29401&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29401&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29401&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29401&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29401&r=float