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 1b1b8e0

Browse filesBrowse files
committed
bug #12417 [HttpFoundation] Fix an issue caused by php's Bug #66606. (wusuopu)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12417). Discussion ---------- [HttpFoundation] Fix an issue caused by php's Bug #66606. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 75df4a6 [HttpFoundation] Fix an issue caused by php's Bug #66606.
2 parents 6116d33 + 75df4a6 commit 1b1b8e0
Copy full SHA for 1b1b8e0

File tree

Expand file treeCollapse file tree

1 file changed

+14
-1
lines changed
Filter options
Expand file treeCollapse file tree

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.