Skip to content
Browse files

[HttpFoundation] Fixed #5697 - Request::createFromGlobals, Request::g…

…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...
1 parent 1202d9a commit 673f74b8e3f234286e743adb315fecb2d27c4c48 @Olden Olden committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/Symfony/Component/HttpFoundation/Request.php
View
4 src/Symfony/Component/HttpFoundation/Request.php
@@ -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);
@@ -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'));
}
/**

0 comments on commit 673f74b

Please sign in to comment.
Something went wrong with that request. Please try again.