ID: 50210
Updated by: [email protected]
Reported By: tyler dot thackray at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Apache2 related
Operating System: Unix (probably all)
PHP Version: 5.2.11
New Comment:
Need reproduce script. Uploading simple form with files works just fine
for me under Apache2..
Previous Comments:
------------------------------------------------------------------------
[2009-11-17 22:49:28] tyler dot thackray at gmail dot com
Excuse me, I accidentally mixed up the Expect and Actual result.
------------------------------------------------------------------------
[2009-11-17 22:46:23] tyler dot thackray at gmail dot com
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 this bug report at http://bugs.php.net/?id=50210&edit=1