#42280 [Opn->Bgs]: Change in file upload behavior
| From: | chris at dented-planet dot net | Date: | Tue, 14 Aug 2007 23:21:40 +0000 |
| Subject: | #42280 [Opn->Bgs]: Change in file upload behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116063@lists.php.net to get a copy of this message | ||
ID: 42280
User updated by: chris at dented-planet dot net
Reported By: chris at dented-planet dot net
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Mac OS X 10.4.10
PHP Version: 5.2.4RC1
New Comment:
There is no bug here. Only someone who doesn't completely understand
how to compile source code.
I was reusing the same source download over and over switching between
--enable-debug and --disable-debug. While I rm'd config.cache, I didn't
remove other generated files in the source directory. I assumed they'd
be overwritten.
Once I downloaded a virgin source code for 5.2.3, the "bug" no longer
occurred.
Sorry!
That being said, can you suggest a good book on learning and compiling
C? I think it's about time I learn a bit more so this doesn't happen
again.
Previous Comments:
------------------------------------------------------------------------
[2007-08-12 22:45:49] chris at dented-planet dot net
I compiled each version myself from source downloaded from php.net
I used the --disable-debug config setting and phpinfo() says "Debug
Build No"
------------------------------------------------------------------------
[2007-08-12 22:16:38] jani@php.net
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..
------------------------------------------------------------------------
[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