merged branch Olden/ticket_5697 (PR #5712)

This PR was merged into the 2.1 branch.

Commits
-------

673f74b [HttpFoundation] Fixed #5697 - Request::createFromGlobals, Request::getContentType Changed checking CONTENT_TYPE from server to headers variable

Discussion
----------

[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:
Fabien Potencier 2012-10-09 15:19:22 +02:00
commit 85dd3c20a3

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'));
}
/**