php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30006 Incorrect parsing of POST/GET part of HTTP reqest
Submitted: 2004-09-07 09:52 UTC Modified: 2004-09-07 10:57 UTC
From: knst at mail dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.7 OS:
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: knst at mail dot ru
New email:
PHP Version: OS:

 

 [2004-09-07 09:52 UTC] knst at mail dot ru
Description:
------------
I've got a problem while trying to process results of submitting such kind of a form :
<form  method=post >
<input name=vname value="1"><BR>
<input name=vname value="2"><BR>
<input name=vname value="3"><BR>
<input name=vname value="4"><BR>
<input type=submit><BR>
</form>
PHP generates only one variable $vname with value 4
instead of array  $vaname[] with 4 elements.

It was impossible to change html of the form. So I had to parse data read from 'php://input'.







Reproduce code:
---------------
Submittion of 
<form  method=post >
<input name=vname value="1"><BR>
<input name=vname value="2"><BR>
<input name=vname value="3"><BR>
<input name=vname value="4"><BR>
<input type=submit><BR>
</form>

Expected result:
----------------
value of $vname is
array( 
0 => 1, 
0 => 2,
0 => 3,
0 => 4)

Actual result:
--------------
value of $vname is 4


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-07 10:02 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 [2004-09-07 10:57 UTC] rasmus@php.net
Your bug was marked bogus because it isn't a bug.  PHP was designed to do it that way.  Parsing the query string directly is your only real option here unless you feel up to patching PHP.  I wrote a patch that changes this behaviour:

  http://lerdorf.com/regvar.diff

But you are completely on your own if you apply this.  You will be running a very non-standard PHP and it may break other scripts rather badly.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC