#42280 [Opn->Fbk]: Change in file upload behavior
| From: | jani@php.net | Date: | Sun, 12 Aug 2007 22:16:38 +0000 |
| Subject: | #42280 [Opn->Fbk]: Change in file upload behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116000@lists.php.net to get a copy of this message | ||
ID: 42280
Updated by: jani@php.net
Reported By: chris at dented-planet dot net
-Status: Open
+Status: Feedback
Bug Type: *General Issues
Operating System: Mac OS X 10.4.10
PHP Version: 5.2.4RC1
New Comment:
Are you absolutely sure you do NOT have a debug build? (check from
phpinfo() output..) I can't see any way in sources for the error to be
'5' if you really aren't using a debug build. It's only possible if you
have patched the sources..
Previous Comments:
------------------------------------------------------------------------
[2007-08-12 21:30:06] chris at dented-planet dot net
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 this bug report at http://bugs.php.net/?id=42280&edit=1