From: [EMAIL PROTECTED] Operating system: linux PHP version: 4.1.1 PHP Bug Type: Unknown/Other Function Bug description: Uploading of binary file
//When some binary data are send to this script it cause netscape //unstable because PHP engine read STDIN incorrectly. //I have try to read this data with script in perl an it was successful. //I append apache logs that this incorrect reading of input causes. //x.y.x.z - - [12/Feb/2002:17:28:31 +0100] "POST /IR/Edit/index.php //HTTP/1.0" 200 431 "/IR/Edit/index.php" "Mozilla/4.77 [en] (X11; U; //Linux 2.4.2-2 i686)" //x.y.x.z - - [12/Feb/2002:17:28:31 +0100] "<9D>ÓYÓÓ+kµ<9C><9A>YŦ|]z/ì;¦ //<85>ÜÕÃÜ$ÿ#]Ògbu\¨Òe½³<87>^B" 200 5364 "-" "-" //first log is ok //but second is proof of this uncorrect STDIN reading //it not depend if function //move_uploaded_file($HTTP_POST_FILES['userfile'],"/place/to/put/uploaded///file"); //or //copy($HTTP_POST_FILES['userfile']['tmp_name'],"/place/to/put/uploaded/////file"); //are used. //This error don't occure if I try to upload file of text/plain. //But have been occuring ever when I try to read i.e. image/gif <TABLE bgcolor=#ffffff> <FORM ENCTYPE="multipart/form-data" METHOD=POST ACTION="<?PHP echo "http://$SERVER_NAME$SCRIPT_NAME"; // echo "http://$SERVER_NAME/cgi-bin/UpLoader"; ?>"> <TR><TD></TD><TD></TD></TR> <TR><TD>Sample name:</TD><TD><INPUT NAME="Sample" TYPE=TEXT></TD></TR> <TR><TD valign=top>Notes:</TD><TD><TEXTAREA NAME="SpNotes" ROWS=5 COLS=50></TEXT AREA></TD></TR> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> <TR><TD>Send this file: </TD><TD><INPUT NAME="userfile" TYPE="file"></TD></TR> <TR><TD><INPUT TYPE="submit" VALUE="Send File"></TD><TD><INPUT TYPE="reset"></TD ></TR> </FORM> </TABLE> <?PHP $Sample = preg_replace("/[^a-zA-Z0-9]/","",$Sample); if ($Sample != "") { if (move_uploaded_file($HTTP_POST_FILES['userfile'], $IRDirectory . $Sample . ".ir" )) { if ($SpNotes != "") { $fp = fopen($IRDirectory . $Sample . ".txt","w+"); fwrite($fp, $SpNotes); fclose($fp); } } else { echo "File not found !!!\n"; } } -- Edit bug report at http://bugs.php.net/?id=15526&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15526&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15526&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15526&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15526&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15526&r=support Expected behavior: http://bugs.php.net/fix.php?id=15526&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15526&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15526&r=submittedtwice