[HttpFoundation] Fixed #5697 - Request::createFromGlobals, Request::getContentType

Changed checking CONTENT_TYPE from server to headers variable

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5697
Todo: -
License of the code: MIT
This commit is contained in:
Alexander Kotynia 2012-10-09 11:56:57 +03:00
parent 1202d9a738
commit 673f74b8e3

View File

@ -217,7 +217,7 @@ class Request
{
$request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
if (0 === strpos($request->server->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
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'))
) {
parse_str($request->getContent(), $data);
@ -1043,7 +1043,7 @@ class Request
*/
public function getContentType()
{
return $this->getFormat($this->server->get('CONTENT_TYPE'));
return $this->getFormat($this->headers->get('CONTENT_TYPE'));
}
/**