|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34594 [Solved] Arrays from form get send over as string instead of array
Submitted: 2005-09-22 11:01 UTC Modified: 2005-09-22 15:12 UTC
From: thijs at toltech dot nl Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.0.5 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: thijs at toltech dot nl
New email:
PHP Version: OS:


 [2005-09-22 11:01 UTC] thijs at toltech dot nl
By using form you can send Arrays over to the next page with the name="var_name[]" method.

However, doing this will result in that the $_POST['var_name'] will contain the string 'Array' all the time, no matter what is really send in.

(Note: this also happend to me in php5.1.0-b3, gentoo forced me to downgrade but I think it is also in php5.1.0-rc1, would be glad if anyone can check this for me)

Reproduce code:
<select name="color[]">
<option value="*">All</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="orange">Orange</option>
<option value="yellow">Yellow</option>

and on the next page in php code:


Expected result:
The expected result is (assuming you selected 'Green' and 'Red':

    [color] = Array 
        [0] = red
        [1] = green

Actual result:
while will produce (no matter what you select):

    [color] = Array


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-22 11:11 UTC]
Please try using this CVS snapshot:
For Windows:

Works perfectly here.
 [2005-09-22 12:27 UTC] thijs at toltech dot nl
I'm unable to post feedback on this matter due to that make install fails on the location of the apache conf file. 

(Which is httpd.conf instead of apache2.conf, I configured php with the configuration taken from phpinfo() from my current php installation)
 [2005-09-22 12:31 UTC]
Works fine for me too when using proper HTML form.

 [2005-09-22 12:50 UTC] thijs at toltech dot nl
I have been testing this now as well since sais this works.. it now works for me as well except in the form where I want it to work.. I first thought this was caused by the template engine, but it isn't..

I will try to find out what is causing this..
 [2005-09-22 15:07 UTC] thijs at toltech dot nl
Ok I found the problem, Every variable that is send over (GET and POST) variables is being checked:

foreach($_POST as $key => $value)
    $_POST[$key] = addslashes(trim($value));

This somehow caused it to be a string with the value 'Array'. I searched around for help and found one similair bug on this site that was exactly the same.. so I thought it was a php bug.

Sorry for this invalid bug post..
I closed it now
 [2005-09-22 15:12 UTC]
We mark user errors as 'Bogus'.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 19:01:30 2024 UTC