ID: 22427 Comment by: admin at ensifex dot nl Reported By: jroland at uow dot edu dot au Status: No Feedback Bug Type: *General Issues Operating System: Windows XP / 2000 PHP Version: 4.2.3 New Comment:
After updating from 4.3.7 to 4.3.8 i'm loosing POST data. If i create a form with normal text fields and not to much input data there doesn't seem to be a problem. If i use <textarea> with a text larger 985 characters the post data is not send. Used this script to test: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> </head> <body> <form action="index.php" method="post"> <textarea name="text"></textarea> <input type="submit" </form> <? print_r($_POST); ?> </body> </html> if i add 'enctype="multipart/form-data"' to the form. All post data is send. php version : 4.3.8 os: OpenBSD 3.5-current apache: 1.3.29 Previous Comments: ------------------------------------------------------------------------ [2004-07-30 22:11:28] gary at garyslittlecompany dot com I too am experiencing what has been described in the this submission. I think I have isolated it to php on windows. I summarize it thus because I have an xp, w2k3 and wme servers that experience the same problem. Yes I have used the latest version as of today 4.3.9 build date 7/30/04. I have scripts that have alot of post data, a table full of input objects, the table can be quite large. If I exceed a certain amount (I know it is not an arbitrary size, but I don't know what the size is, but I can duplicate it). Below are my scripts. <?php print '<html><head></head><body><form name = "pageform" action = "post.php" method = "post"><table>'; for ($l = 0; $l < 100; ++$l) { print "<tr><td>First Name</td><td><input type = \"text\", name = \"firstname[$l]\" /></td>\r\n"; print "<td>Last Name</td><td><input type = \"text\", name = \"lastname[$l]\" /></td>\r\n"; print "<td>City</td><td><input type = \"text\", name = \"city[$l]\" /></td>\r\n"; print "<td>State</td><td><input type = \"text\", name = \"state[$l]\" /></td></tr>\r\n"; } print '</table><input type = "submit" value = "submit"/></form></body></html>'; ?> This simply provides my form with a lot of input elements in my html. When submitted it will call the following script <?php print getenv('CONTENT_LENGTH'); print "$HTTP_RAW_POST_DATA<br>"; print_r($_POST); ?> Here is the output 6559 Array ( ) Now if I change my script (action = "cgi-bin\post.ext") to call the following c compiled script... #include <stdio.h> #include <stdlib.h> #include <string.h> main() { char *endptr; int i; double contentlength; char buff[10000]; char a,b; const char *len1 = getenv("CONTENT_LENGTH"); contentlength=strtol(len1, &endptr, 10); fread(buff, contentlength, 1, stdin); printf("Content-type: text/html\n\n%s",buff); } to do the same thing essentially I will get the following 5B95%5D=&lastname%5B95%5D=&city%5B95%5D=&state%5B95%5D=&firstname%5B96%5D=&lastname%5B96%5D=&city%5B96%5D=&state%5B96%5D=&firstname%5B97%5D=&lastname%5B97%5D=&city%5B97%5D=&state%5B97%5D=&firstname%5B98%5D=&lastname%5B98%5D=&city%5B98%5D=&state%5B98%5D=&firstname%5B99%5D=&lastname%5B99%5D=&city%5B99%5D=&state%5B99%5D= This is just a portion of the data that I get, it happens to be the last of the output do demonstrate that I do get the last of the input elements, notice city%5b99%5d, this is the 99th city element, the loop goes from 0-99. Now if you reduce the loop to be 0-5 for example (for ($l = 0; $l < 5; ++$l)) I get the following output when I use the first script (action = "post.php"). 309firstname%5B0%5D=&lastname%5B0%5D=&city%5B0%5D=&state%5B0%5D=&firstname%5B1%5D=&lastname%5B1%5D=&city%5B1%5D=&state%5B1%5D=&firstname%5B2%5D=&lastname%5B2%5D=&city%5B2%5D=&state%5B2%5D=&firstname%5B3%5D=&lastname%5B3%5D=&city%5B3%5D=&state%5B3%5D=&firstname%5B4%5D=&lastname%5B4%5D=&city%5B4%5D=&state%5B4%5D= Array ( [firstname] => Array ( [0] => [1] => [2] => [3] => [4] => ) [lastname] => Array ( [0] => [1] => [2] => [3] => [4] => ) [city] => Array ( [0] => [1] => [2] => [3] => [4] => ) [state] => Array ( [0] => [1] => [2] => [3] => [4] => ) ) The first part is the raw post data, the last is the $_POST variable. I did the c compiled script, simply to rule out my webserver (apache 1.3.27). ------------------------------------------------------------------------ [2004-07-17 17:51:19] c dot neise at gmx dot de I have also the first of these problems. The script below reproduces the bug. When entering a small amount of data, the data is displayed. With a large amount of data (e.g. a screen full of letters pasted into the text area) the data is lost. I am using gentoo linux, php 4.3.8 and Apache 2.0.50. If anything is missing please let me know. Best regards, Christian Neise. <html> <body> <form method="POST"> <textarea name="test"> <?php echo $_POST['test']; ?> </textarea> <hr><input type="submit" name="dummy"><hr> <pre> <?php print_r($_POST); ?> </pre> </body> </html> ------------------------------------------------------------------------ [2004-02-20 08:07:17] vincentfinet at hotmail dot com Hi, Don't know if it helps but I found out that informations about the file uploaded from a form using "multipart/form-data" like in the example below is not in the $_POST array but in the $_FILES array <form enctype="multipart/form-data" method="post" action="WinnyReader.php"> <input type="file" name="fWinnyFile" size="40" /> <input type="submit" value="Go" /> </form> After hitting the submit button, the second script (in my example, "WinnyReader.php") will look for informations about the file in $_FILES["fWinnyFile"] (and not in $_POST["fWinnyFile"] even if the method of the form is POST!!). That will do something like this: if (isset($_FILES["fWinnyFile"])) { $arWinnyFile = $_FILES["fWinnyFile"]; echo "name : " . $arWinnyFile["name"] . "<br />\n"; echo "type : " . $arWinnyFile["type"] . "<br />\n"; echo "tmp_name : " . $arWinnyFile["tmp_name"] . "<br />\n"; echo "error : " . $arWinnyFile["error"] . "<br />\n"; echo "size : " . $arWinnyFile["size"] . "<br />\n"; $stFilename = $arWinnyFile["tmp_name"]; } else { ... } Hope this helps! Vincent FINET ------------------------------------------------------------------------ [2003-12-27 20:28:46] ascj20 at dsl dot pipex dot net On WinXP SP1 / Apache 1.3.27 / PHP 4.2.2(module) / testing locally with IE6 SP1 This bug has changed topic it seems, but on the original matter I have it too - tiny effective limits with $_POST and $_FILES. By echoing getenv(CONTENT_LENGTH) I find a limit of 488 bytes from text-only form data (above which $_POST returns empty). Using HTTP upload by POST the cutoff is about 2.5k for a gif file. (Limit is higher when not using SSL but I guess that is to be expected?) I hope this is a useful contribution to a bug that seems to be taxing a lot of folks. ------------------------------------------------------------------------ [2003-06-05 08:20:19] webmaster at dtshowtime dot lu dot eu dot org I can also reproduce this problem with PHP 4.3.2. ------------------------------------------------------------------------ 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/22427 -- Edit this bug report at http://bugs.php.net/?id=22427&edit=1