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

From: Date: Sun, 28 Jul 2002 11:35:44 +0000
Subject: #17958 [Com]: <input type=file> loses $_POST vars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15441@lists.php.net to get a copy of this message
ID: 17958 Comment by: harry@ilo.de 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: 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 ... Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2002-07-15 03:28:58] sesser@php.net Is it possible for you to do something like tcpdump -w postlog -s 8192 -p tcp to let me see if the post block is somehow broken? If yes send the file directly to my address. ------------------------------------------------------------------------ [2002-07-14 22:15:36] ddp@deakin.edu.au Just in case this helps, I am also running apache2/php4.3.0-dev on linux. Maybe the person who could not reproduce this was not running on linux? ------------------------------------------------------------------------ [2002-07-11 14:32:15] thomas@gelf.it Using php 4.1.2 on apache 1.3.23 (Default Redhat 7.3 - installed today) I have the same problem: if using enctype="multipart/form-data" in a <form>-tag (with or without any <input type="file">), $HTTP_POST_VARS and $_POST will be empty arrays. The same script works perfectly with php 4.0.6 on apache 1.3.19. ------------------------------------------------------------------------ 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

« previous php.bugs (#15441) next »