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.
This commit is contained in:
commit
1b1b8e074e
@ -260,7 +260,20 @@ class Request
|
||||
*/
|
||||
public static function createFromGlobals()
|
||||
{
|
||||
$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
|
||||
// With the php's bug #66606, the php's built-in web server
|
||||
// stores the Content-Type and Content-Length header values in
|
||||
// HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields.
|
||||
$server = $_SERVER;
|
||||
if ('cli-server' === php_sapi_name()) {
|
||||
if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) {
|
||||
$server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH'];
|
||||
}
|
||||
if (array_key_exists('HTTP_CONTENT_TYPE', $_SERVER)) {
|
||||
$server['CONTENT_TYPE'] = $_SERVER['HTTP_CONTENT_TYPE'];
|
||||
}
|
||||
}
|
||||
|
||||
$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $server);
|
||||
|
||||
if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
|
||||
&& in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH'))
|
||||
|
Reference in New Issue
Block a user