Edit report at https://bugs.php.net/bug.php?id=55510&edit=1
ID: 55510
User updated by: aaron at gwmicro dot com
Reported by: aaron at gwmicro dot com
Summary: $_FILES 'name' missing first character after upload.
Status: Open
Type: Bug
Package: Filesystem function related
Operating System: Windows Server 2008 R2
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Yes, I will attempt to get this information to you. I can say that we were using 5.2.13 without
incident prior to updating to 5.3.8. After updating to 5.3.8, we were notified by users that they
could no longer download files that they were successfully uploading. That was when I determined the
missing first character. Because we didn't want to go backward, I put on the 5.4 version, and
the problem went away. Note that no changes were made in the PHP source during the process of
changing versions. I will try to back all that with the requested data.
Previous Comments:
------------------------------------------------------------------------
[2011-08-26 19:02:04] v-mafick at microsoft dot com
I've setup Apache 2.2.19 and PHP 5.3.8 (though not with mod_ssl) and have run the test script
you provided, but it doesn't produce the problem you reported (it works fine).
In your report, $_FILES['filename']['name'] reports the length of the string as
10, even though only 9 characters are displayed.
Is it possible that somewhere in your program you're converting between charsets or mangling
the filename.
Also, could you provide a packet capture of the network traffic between your web browser and your
web application. You can do this with Wireshark (Windows/Linux) or NetMon (Windows).
------------------------------------------------------------------------
[2011-08-25 19:46:39] aaron at gwmicro dot com
While I'm not enamored with the idea of running a beta in production, this problem appears to
be resolved in 5.4.0beta1-dev.
------------------------------------------------------------------------
[2011-08-25 19:36:54] aaron at gwmicro dot com
Description:
------------
After uploading a file using a multipart/form-data HTML form, the resulting file name is missing the
initial character (i.e. readme.txt becomes eadme.txt).
Server: Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/1.0.0d PHP/5.3.8
Test script:
---------------
<FORM ACTION="<? echo $_SERVER['PHP_SELF']; ?>" METHOD="POST"
ENCTYPE="multipart/form-data">
File: <INPUT TYPE="file" NAME="filename">
<INPUT TYPE="submit" VALUE="go">
</FORM>
<?
if (isset($_FILES)) {
var_dump($_FILES);
}
?>
array(1) { ["filename"]=> array(5) { ["name"]=> string(10)
"eadme.txt" ["type"]=> string(10) "text/plain"
["tmp_name"]=> string(31) "C:\temp\file_upload\php7D44.tmp"
["error"]=> int(0) ["size"]=> int(3420) } }
Expected result:
----------------
$_FILES['filename']['name'] should be intact rather than missing the first
character.
["name"]=> string(10) "readme.txt"
Actual result:
--------------
$_FILES['filename']['name'] is missing the first character:
["name"]=> string(10) "eadme.txt"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55510&edit=1