#17958 [Com]: <input type=file> loses $_POST vars

From: Date: Thu, 12 Sep 2002 10:42:28 +0000
Subject: #17958 [Com]: <input type=file> loses $_POST vars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-19228@lists.php.net to get a copy of this message
 ID:               17958
 Comment by:       ichwilleineemailadresse@gmx.net
 Reported By:      ddp@deakin.edu.au
 Status:           Open
 Bug Type:         Apache2 related
 Operating System: Linux 2.4.18
 PHP Version:      4.2.1
 New Comment:

The Bug still appears in PHP 4.2.3


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

[2002-08-26 10:12:39] arash@yalpani.de

I have a similar problem using PHP 4.2.2 and Apache 1.3.23. But only
the first value of the $_POST-vars gets lost.

------------------------------------------------------------------------

[2002-08-21 19:15:37] clindh@homenet.se

I just encountered symptoms quite similar to what you report here. I
lost the first field from my POST:ed data when I had
enctype"multipart/form-data" encoding on the form - with default
encoding it worked fine. I never lost all POST:ed values though; just
the first one (which happens to be a hidden field, but PHP does not
know that). I know this worked fine with the same browser (IE6) while
we were running PHP 4.1, we recently upgraded.
 
This is with PHP 4.2.2 and Apache 1.3.26

------------------------------------------------------------------------

[2002-07-28 07:35:42] harry@ilo.de

I could reproduce this Bug with Apache 1.3.23 and PHP4.2.1, 4.2.2 and
4.3.0-dev (2002-28-07), OS is WinXP Pro.
All Form-Data using method=post is lost as soon as I add
enctype="multipart/form-data" to <form>. It doesn't matter if there's a
<input type="file"> in the form or not. The Bug does not always appear,
but it seems to happen more often in php4.3.0-dev (~80%) than it was in
4.2.1 (~40%) or 4.2.2 (~60%),

The code I used to test this:

------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>enctype-testpage</title>
</head>

<body>

<?php

# DEBUG
echo "POST:<br>";
while(list($pkey, $pvalue)=each($_POST))
	echo $pkey." = ".$pvalue."<br>";
echo "<br>GET:<br>";
while(list($pkey, $pvalue)=each($_GET))
	echo $pkey." = ".$pvalue."<br>";
echo "<br>";
reset($_GET);
reset($_POST);
# /DEBUG

?>

<form method="post" action="<?=$_SERVER["PHP_SELF"]?>"
enctype="multipart/form-data">
	<input name="xx" value="<?= $_POST["xx"] ?>"><br>
	<input name="xx" value="<?= $_POST["xy"] ?>"><br>
	<input name="xx" value="<?= $_POST["xz"] ?>"><br>
	<textarea name="yx"><?= $_POST["yx"] ?></textarea><br>
	<input type="hidden" name="b" value="z">
	<input type="submit" name="s1" value="go">
</form>

</body>
</html>
---------------------------------------------------

My file was called test.php and was therefore not the index-file of the
directory.
The Bug appeared with Internet Explorer 6 and Mozilla 1.0.
Opera 6.01 was also affected but less than the others (only around 5%
of my tries were buggy). Mozilla (~50%) is also less affected than IE
(80-90%).

Some Info you might need:

-------------------------------------

SERVER_SOFTWARE Apache/1.3.23 (Win32) PHP/4.3.0-dev mod_gzip/1.3.19.1a
mod_ssl/2.8.6 OpenSSL/0.9.6c 

Build Date Jul 28 2002 12:10:10 

Server API Apache 

Virtual Directory Support enabled 

Configuration File (php.ini) Path C:\WINDOWS\php.ini 

API Versions: PHP: 20020307
PHP Extension: 20020429
Zend Extension: 20020429 

Debug Build no 

Thread Safety enabled 

Apache Version Apache/1.3.24 
Apache Release 10324100 
Apache API Version 19990320 

-------------------------------------

Interesting note, PHP reports 1.3.23 as the apache-version one time and
the other time 1.3.24 ...

------------------------------------------------------------------------

[2002-07-19 17:44:29] djresonance@yahoo.com

Sorry, I should also note that I do have file uploading enabled in my
php.ini file, and that I've tested with windows browsers, not linux.

------------------------------------------------------------------------

[2002-07-19 17:41:44] djresonance@yahoo.com

I experience the same problem with php 4.2.1 on IIS 4.0.  What happens
is that if the form type is set to mutlipart/form-data, the $_POST vars
are lost.  An interesting note, the problem does not happen with
Mozilla 1.0, only with IE 5.5.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17958

-- 
Edit this bug report at http://bugs.php.net/?id=17958&edit=1



Thread (39 messages)

« previous php.bugs (#19228) next »