From: tyler dot thackray at gmail dot com
Operating system: Unix (probably all)
PHP version: 5.2.11
PHP Bug Type: Apache2 related
Bug description: PHP won't parse multipart/form-data if it was originally
chunk encoded.
Description:
------------
When POSTing multipart/form-data to a PHP script, PHP will automatically
parse the data into $_FILES and $_POST super globals. In this case,
php://stdio will be empty.
Apache 2 supports chunked encoded requests. When sending
multipart/form-data with "transfer-encoding: chunked" Apache 2 will dechunk
the request and pass it onto PHP. However, in this case PHP will NOT parse
the multipart/form-data and the RAW data can be seen at php://stdio. I've
examined the headers and the only difference between the working and not
working is the "transfer-encoding: chunked"; the "content-type:
multipart/form-data, boundry=XXXX" is still present.
Perhaps this is an issue with mod_php? Perhaps the chunked header is
confusing PHP? In any case, I would expect PHP to parse the
multipart/form-data regardless if it was originally chunked or not, as
Apache should take care of the chunks.
It's interesting to note that the headers can be combined with php://stdio
and resent to the same script (not chunked but still multipart/form-data
encoded) and PHP will actually parse it.
There's no easy way to provide sample code for this issue, suffice it to
say that if you send multipart/form-data using chunked encoding to any PHP
script, you will find that $_FILES and $_POST are empty and the raw data is
present at php://stdio.
Reproduce code:
---------------
<?php
print_r($_FILES);
print_r($_POST);
?>
Expected result:
----------------
"Array() Array()"
Actual result:
--------------
The $_FILES and $_POST super global should contain parsed data.
--
Edit bug report at http://bugs.php.net/?id=50210&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50210&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50210&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50210&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50210&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50210&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50210&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50210&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50210&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50210&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50210&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50210&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50210&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50210&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50210&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50210&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50210&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50210&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50210&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50210&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50210&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50210&r=mysqlcfg