Built in web server not accepting file uploads
| Bug #55450 | Built in web server not accepting file uploads | ||||
|---|---|---|---|---|---|
| Submitted: | 2011-08-18 14:19 UTC | Modified: | 2011-08-19 11:55 UTC | ||
| From: | scott at aubrey dot org dot uk | Assigned: | laruence (profile) | ||
| Status: | Closed | Package: | Built-in web server | ||
| PHP Version: | 5.4.0alpha3 | OS: | Mac OS X 10.7.1 (Lion ) | ||
| Private report: | No | CVE-ID: | None | ||
[2011-08-18 14:19 UTC] scott at aubrey dot org dot uk
Description:
------------
The built in web server does not handle file uploads, instead throwing an error.
This is a fairly clean build of alpha 3.
Test script:
---------------
<?php
var_dump($_SERVER);
?>
<form enctype="multipart/form-data" method="post">
<label for="filename">Select a file to upload:</label><br>
<input type="file" id="file" name="file">
<br><br>
<input type="submit" name="action" value="Upload">
</form>
Expected result:
----------------
array(1) { ["file"]=> array(5) { ["name"]=> string(7) "testupload.txt" ["type"]=>
string(10) "text/plain" ["tmp_name"]=> string(26) "/private/var/tmp/phpynOZom"
["error"]=> int(0) ["size"]=> int(12) } }
Actual result:
--------------
array(0) { }
--
Error log throws:
PHP Warning: Missing boundary in multipart/form-data POST data in Unknown on
line 0
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2011-08-18 14:22 UTC] scott at aubrey dot org dot uk
[2011-08-18 14:42 UTC] johannes@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: moriyoshi
[2011-08-19 06:37 UTC] laruence@php.net
this should due to the following code in sapi/cli/php_cli_server.c 2161 : php_cli_server_client_populate_request_info: ... { char **val; const char delimiter[] = ";"; if (SUCCESS == zend_hash_find(&client->request.headers, "Content-Type", sizeof("Content-Type"), (void**)&val)) { request_info->content_type = strtok(*val, delimiter); } } ... which erased the boundary content of "multipart/form-data; boundary=----****",[2011-08-19 11:55 UTC] laruence@php.net
-Status: Assigned +Status: Closed -Assigned To: moriyoshi +Assigned To: laruence