From: jose dot nobile at gmail dot com
Operating system: Win XP+Apache 2.2.11+PHP 5.2.9-2
PHP version: 5.2.9
PHP Bug Type: Arrays related
Bug description: Multi-dimensional $_FILES are not consistent.
Description:
------------
At POST request with multidimensional form vars, $_FILES are not
"correctly" assign, the $_FILES is not "easy" to handle with actual
multidimensional assign, it is not consistent.
Reproduce code:
---------------
<?PHP
if($_SERVER['REQUEST_METHOD'] == 'POST'){
print_r($_FILES);
}
?>
<form name="form" action="" enctype="multipart/form-data" method="POST">
<input type="file" name="file[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="file" name="foto[]" /><br />
<input type="submit" value="Submit" />
</form>
Expected result:
----------------
Array
(
[file] => Array
(
[0] => Array
(
[name] => foto internet workstation.JPG
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php171.tmp
[error] => 0
[size] => 99115
)
[1] => Array
(
[name] => gfs 0.JPG
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php172.tmp
[error] => 0
[size] => 26263
)
[2] => Array
(
[name] => hoja membretiada.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php173.tmp
[error] => 0
[size] => 245987
)
[3] => Array
(
[name] => img005CEDULA ADMINISTRATIVA.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php174.tmp
[error] => 0
[size] => 283589
)
[4] => Array
(
[name] => kathe 3 copy.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php175.tmp
[error] => 0
[size] => 122558
)
)
)
Actual result:
--------------
Array
(
[file] => Array
(
[name] => Array
(
[0] => foto internet workstation.JPG
)
[type] => Array
(
[0] => image/jpeg
)
[tmp_name] => Array
(
[0] => C:\wamp\tmp\php15C.tmp
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 99115
)
)
[foto] => Array
(
[name] => Array
(
[0] => gfs 0.JPG
[1] => hoja membretiada.jpg
[2] => img005CEDULA ADMINISTRATIVA.jpg
[3] => kathe 3 copy.jpg
)
[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
[2] => image/jpeg
[3] => image/jpeg
)
[tmp_name] => Array
(
[0] => C:\wamp\tmp\php15D.tmp
[1] => C:\wamp\tmp\php15E.tmp
[2] => C:\wamp\tmp\php15F.tmp
[3] => C:\wamp\tmp\php160.tmp
)
[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
)
[size] => Array
(
[0] => 26263
[1] => 245987
[2] => 283589
[3] => 122558
)
)
)
--
Edit bug report at http://bugs.php.net/?id=48077&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48077&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48077&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48077&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48077&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48077&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48077&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48077&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48077&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48077&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48077&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48077&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48077&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48077&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48077&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48077&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48077&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48077&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48077&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48077&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48077&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48077&r=mysqlcfg