Skip to content

Commit

Permalink
[HttpFoundation] Fixed #5697 - Request::createFromGlobals, Request::g…
Browse files Browse the repository at this point in the history
…etContentType

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
  • Loading branch information
Alexander Kotynia committed Oct 9, 2012
1 parent 1202d9a commit 673f74b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -217,7 +217,7 @@ public static function createFromGlobals()
{
$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);
Expand Down Expand Up @@ -1043,7 +1043,7 @@ public function setRequestFormat($format)
*/
public function getContentType()
{
return $this->getFormat($this->server->get('CONTENT_TYPE'));
return $this->getFormat($this->headers->get('CONTENT_TYPE'));
}

/**
Expand Down

0 comments on commit 673f74b

Please sign in to comment.