From: david at grudl dot com
Operating system: windows xp
PHP version: 5.3.0alpha2
PHP Bug Type: HTTP related
Bug description: Magic quotes broke $_FILES
Description:
------------
When magic_quotes_gpc are enabled, array $_FILES in weird.
1) truncated file name (see "closed" bug #29369)
2) slashes and non-slashed keys
Reproduce code:
---------------
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="o'file">
</form>
Lets upload file named o'brazek.png (there are quotes in element name and
in file name to demonstrate both errors)
Expected result:
----------------
array(2) {
"o\'file" => array(4) {
"name" => string(11) "o'brazek.png" // or o\'brazek.png ?
"type" => string(11) "image/x-png"
"error" => int(0)
"size" => int(20624)
"tmp_name" => string(23) "C:\PHP\temp\php3ED8.tmp"
}
}
Actual result:
--------------
array(2) {
"o\'file" => array(4) {
"name" => string(11) "o" // name is truncated after quote
"type" => string(11) "image/x-png"
"error" => int(0)
"size" => int(20624)
}
"o'file" => array(1) { // tmp_name is stored in different key
"tmp_name" => string(23) "C:\PHP\temp\php3ED8.tmp"
}
}
--
Edit bug report at http://bugs.php.net/?id=46313&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46313&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46313&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46313&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46313&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46313&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46313&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46313&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46313&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46313&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46313&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46313&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46313&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46313&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46313&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46313&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46313&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46313&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46313&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46313&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46313&r=mysqlcfg