php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17739 form select multiple returns double values
Submitted: 2002-06-13 07:35 UTC Modified: 2003-06-26 18:19 UTC
Votes:26
Avg. Score:3.3 ± 1.2
Reproduced:11 of 15 (73.3%)
Same Version:6 (54.5%)
Same OS:5 (45.5%)
From: php at remove dot gustl dot net Assigned:
Status: No Feedback Package: Apache2 related
PHP Version: 4.2.1 OS: all
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at remove dot gustl dot net
New email:
PHP Version: OS:

 

 [2002-06-13 07:35 UTC] php at remove dot gustl dot net
A very special (maybe browser only) problem, when I post a form under following conditions:
1. form enctype="multipart/form-data"
2. <select ..> or <select multiple..> with unicode-values
3. and a file upload
4. only from IE 5.0 (30% of my visitors), other browsers ok
5. and you select a value with unicodes

the returned array contains the selected values twice, like:

  ["currency"]=>
  array(2) {
    [0]=>
    string(12) "? Euro"
    [1]=>
    string(12) "? Euro"
  }

the script (www.gustl.at/testmultisel.php):
<html>
  <head>
    <title>select multiple</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  </head>
  <body>
    <form method="post" enctype="multipart/form-data">
      which are your favorite currencies
      <select size="2" multiple name="currency[]">
        <option>&#8364; Euro</option>
        <option>$ Dollar</option>
      </select><br>
      and send a file <input type="file" name="uploadedfile"><br>
      <input type="submit">
    </form>
    <?php
      echo "<br>post: <listing>";
      var_dump ($_POST);
      echo "</listing>";
    ?>
  </body>
</html>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-13 10:27 UTC] sander@php.net
If it only happens with IE, or one version of IE, then it's not a bug in PHP but yet another bug in IE.
 [2002-06-13 12:05 UTC] php at remove dot gustl dot net
this may be true, but do you know how this happens or how I can analyze the problem, because I don't get $HTTP_RAW_POST_DATA when enctype is set to "multipart/form-data", even when I set always_populate_raw_post_data = On.

My workarround for now is to put the select post results through array_unique (),
 [2002-06-13 13:27 UTC] sesser@php.net
It happens because some guy at Microsoft was drunken.

Infact you are triggering a situation where the IE 5.0
simply sends every form field 2 times.



 [2002-10-07 11:19 UTC] rst at biba dot uni-bremen dot de
I could trace the same behaviour in a different script: IE5.0, multipart/formdata and a special char copied from a Winword document.

Indeed, I wonder, if it is IE5.0 that is doubling the array, or there is any strange thing (in IE5.0) that causes php to double the array when receiving it. The first is of course a bug in IE5.0. The latter would be one in php.

Maybe a developer can sniff the transmitted code and trace if IE5.0 is already doubling the value(s) or if this happens in php's value-handling.

Ren?
PS: For the time being we use array_unique() to filter out the doubled values in our array but this is not helpful if double values are allowed in an array.
 [2003-06-20 08:55 UTC] philip@php.net
Can you test 4.3.3RC1?  Many Apache2+PHP issues have been fixed since PHP 4.2.2.  Reporting bugs with PHP 4.2.2 is pretty much useless, despite what RH ships with.

Download 4.3.3 here:
http://qa.php.net/
 [2003-06-26 18:19 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-09-01 03:51 UTC] itaka--nothis-- at hotmail dot com
I believe it is Internet Explorer 5 and 6. I have seen this happen on Win2k, IIS and ASP.

What it looks like is that IE restarts building the formdata after a certain point, sometimes using the same boundary, sometimes using a different boundary. When it uses the same boundary, the formfields that have been already processed, will be repeated. When it uses another boundary, it depends on how the formdata are being parsed: if only the last boundary is being used (the one that is send along as a header), usually there are no problems, although sometimes the first formfield is send corrupted (and missing after parsing).

I have seen the behaviour both in IE 5 and 6, although IE 6 seems not so easy to trigger into it.

Also there are quite a number of references to this problem in various discussion groups. But no one really knows what is going on and what triggers the bug.

I found that it is needed to use multipart/form-data, have an <input type="file"> and have a long text in a textarea, which contains non-standard characters. Also having a javascript-submit helps it trigger.

other posts refering to this are for example:

http://www.houseoffusion.com/cf_lists/cache/4/23/23107.htm
http://mathforum.org/epigone/modperl/sweuphendbrong/1058388072.1311.58.camel@beast
 [2006-05-15 09:26 UTC] stevenbg at gmail dot com
i have the same problem with ie6 and a big form (multipart/form-data, select, BIG textarea with FCKEditor).
i used WPE (winsock packet editor) to capture the packets that IE generated and, yes, the problem is in IE.
sadly, this bug is very poorly documentated
 [2008-02-19 19:58 UTC] bob at bob-russell dot net
I see this is an old discussion but I hope someone will discover my call for help.
There are lots of 'complains' on different web blogs concerning IE 6 or 7 sending form data twice. 
Most replies suggest that the user is hitting the submit button twice.
I don't think this always the case.
I am getting the problem almost permanently with both IE 6 and IE 7. but no problem with Firefox or Opera!
For info my form data is handled by php.
Only login name, password and submit are being sent.
I have made the receiving page record a log of it's activities and (only with IE) the page runs twice! 
The first time with all the $_POST variables empty. 
The second time they are populated with correct values.
These tests are made on a local Apache test setup.
The same thing happens on the live web site but the first time sometimes has corrupt data. 
The second time seems to be ok as on local test.
I am at a loss and can't find anything on the web which gets down to this problem.
Bob R.

Any ideas for a fix (apart of telling all users to go over to Firefox!).
 [2008-08-08 05:38 UTC] srinivasan at rage-india dot com
I also face the same issue. check the below code.

 <body>
  <form method="post" action="fpost.php">
  <table>
  <tr>
	<td>Name</td>
	<td><input type="text" name="a[]" size="20"></td>
  </tr>
  <tr>
	<td>Name 1</td>
	<td><input type="text" name="a[]" size="20"></td>
  </tr>
  <tr>
	<td>Name 2</td>
	<td><input type="text" name="a[]" size="20"></td>
  </tr>
  <tr>
	<td>Name 3</td>
	<td><input type="text" name="a[]" size="20"></td>
  </tr>
  <tr>
	<td>Go</td>
	<td><input type="submit" value="Proceed"></td>
  </tr>
  </table>
  </form>

my print_r($_POST) returns as 

Array
(
    [a] => Array
        (
            [0] => a
            [1] => b
            [2] => c
            [3] => da[]=a
            [4] => b
            [5] => c
            [6] => d
        )

)

I get this issue on IE and Firefox.

Any Help
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC