Bug #55450 [Asn->Csd]: Built in web server not accepting file uploads
| From: | laruence@php.net | Date: | Fri, 19 Aug 2011 11:55:55 +0000 |
| Subject: | Bug #55450 [Asn->Csd]: Built in web server not accepting file uploads | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162692@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55450&edit=1
ID: 55450
Updated by: laruence@php.net
Reported by: scott at aubrey dot org dot uk
Summary: Built in web server not accepting file uploads
-Status: Assigned
+Status: Closed
Type: Bug
Package: Built-in web server
Operating System: Mac OS X 10.7.1 (Lion )
PHP Version: 5.4.0alpha3
-Assigned To: moriyoshi
+Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-08-19 08:52:22] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=315164
Log: News for bug #55450
------------------------------------------------------------------------
[2011-08-19 08:30:19] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&revision=315162
Log: Fixed #55450 (Built in web server not accepting file uploads), which might break #55121
fixing(r313677)
Reopened #55121 to let somebody redone the fixing(as I can't reproduce 55121 in redhat 64-bit).
------------------------------------------------------------------------
[2011-08-19 06:37:48] 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-18 14:22:03] scott at aubrey dot org dot uk
forgot to add, that I started the server with:
php -nS localhost:8001 -t.
and the server output was:
[Thu Aug 18 15:13:56 2011] ::1:54367 GET /testUpload.php - Request read
[Thu Aug 18 15:13:56 2011] ::1:54367 GET /testUpload.php - Response sent successfully (200)
[Thu Aug 18 15:14:01 2011] ::1:54369 POST /testUpload.php - Request read
[Thu Aug 18 15:14:01 2011] ::1:54369 POST /testUpload.php - Response sent successfully (200)
------------------------------------------------------------------------
[2011-08-18 14:19:47] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55450&edit=1