#42280 [NEW]: Change in File Upload Behavior
| From: | chris at dented-planet dot net | Date: | Sun, 12 Aug 2007 21:30:07 +0000 |
| Subject: | #42280 [NEW]: Change in File Upload Behavior | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-115998@lists.php.net to get a copy of this message | ||
From: chris at dented-planet dot net
Operating system: Mac OS X 10.4.10
PHP version: 5.2.4RC1
PHP Bug Type: Unknown/Other Function
Bug description: Change in File Upload Behavior
Description:
------------
I don't know if this is considered a bug there there has been a change in
behavior in the File Upload handling when uploading a zero-length file.
The change happened after PHP 5.2.2 and is in 5.2.4RC1 as well.
Note: I am not using a debug build.
Reproduce code:
---------------
Use this code to upload a zero-length file (I used Firefox 1.5.x):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en-US">
<head></head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']
?>"
enctype="multipart/form-data">
<input type="file" name="upload_file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
<br />
<pre>
<?php
var_dump($_FILES);
?>
</pre>
</body>
</html>
Expected result:
----------------
In PHP 5.2.2, the output of var_dump($_FILES) is:
array(1) {
["upload_file"]=>
array(5) {
["name"]=>
string(9) "empty.txt"
["type"]=>
string(10) "text/plain"
["tmp_name"]=>
string(18) "/var/tmp/phpLAvnSB"
["error"]=>
int(0)
["size"]=>
int(0)
}
}
In PHP 5.2.3 and later it is:
array(1) {
["upload_file"]=>
array(5) {
["name"]=>
string(9) "empty.txt"
["type"]=>
string(0) ""
["tmp_name"]=>
string(0) ""
["error"]=>
int(5)
["size"]=>
int(0)
}
}
Especially, notice the change in "error".
--
Edit bug report at http://bugs.php.net/?id=42280&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42280&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42280&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42280&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42280&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42280&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42280&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42280&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42280&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42280&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42280&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42280&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42280&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42280&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42280&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42280&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42280&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42280&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42280&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42280&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42280&r=mysqlcfg