Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 75df4a6

Browse filesBrowse files
wusuopufabpot
authored andcommitted
[HttpFoundation] Fix an issue caused by php's Bug #66606.
1 parent 6116d33 commit 75df4a6
Copy full SHA for 75df4a6

File tree

1 file changed

+14
-1
lines changed
Filter options

1 file changed

+14
-1
lines changed

‎src/Symfony/Component/HttpFoundation/Request.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Request.php
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,20 @@ public function initialize(array $query = array(), array $request = array(), arr
260260
*/
261261
public static function createFromGlobals()
262262
{
263-
$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
263+
// With the php's bug #66606, the php's built-in web server
264+
// stores the Content-Type and Content-Length header values in
265+
// HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields.
266+
$server = $_SERVER;
267+
if ('cli-server' === php_sapi_name()) {
268+
if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) {
269+
$server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH'];
270+
}
271+
if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
272+
$server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
273+
}
274+
}
275+
276+
$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
264277

265278
if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
266279
&& in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.