From: [EMAIL PROTECTED]
Operating system: RedHat Linux 7
PHP version: 4.0.4pl1
PHP Bug Type: *Directory/Filesystem functions
Bug description: MIME type gets added to variable using POST method
Every time I try to use POST to submit variables or files to a form it seems to add
the mimetype to the variable. (GET seems to work fine, but then I can't upload files)
If I upload a Jpeg file, it adds "Content-Type: image/jpeg" to the variable. or if I
submit a "TEXT AREA" to the script it adds "Content-Type: application/octet-stream" to
the variable.
I also noticed that a normal TEXT variable gets some extra whitespace added to it in
the script, so I had to use trim() to remove that.
I found a workaround for the file-upload bug somewhere :
function fix_php_upload_bug($tmp) {
$infile=fopen($tmp,"r"); // Open the file for the copy
$outfile=fopen("$tmp.new","w"); // create a new temp file
$header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't add
a Content-type line)
//if its more than just a \r\n sequence then
if (strlen($header)>2) $header=fgets($infile,255); //get next line also
while(!feof($infile)) { // Loop through the remaining file
$temp=fread($infile,128);
fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file
}
fclose($outfile);
fclose($infile);
copy("$tmp.new","$tmp"); //replace the original with our new bug fixed file
unlink("$tmp.new"); //and delete the new file
return filesize($tmp); //return a true file size
}
Configure Command : './configure' '--prefix=/usr' '--with-config-file-path=/etc'
'--disable-debug' '--enable-pic' '--enable-shared' '--enable-inline-optimization'
'--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-regex=system'
'--with-gettext' '--with-gd' '--with-jpeg-dir=/usr' '--with-png' '--with-zlib'
'--with-db2' '--with-db3' '--with-gdbm' '--enable-debugger' '--enable-magic-quotes'
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-yp' '--enable-ftp' '--enable-wddx' '--without-mysql'
'--without-oracle' '--without-oci8' '--with-xml'
--
Edit Bug report at: http://bugs.php.net/?id=9844&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]