From efd1f1358c310e75f1f435b79c7a0e73358f9a50 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 9 May 2011 15:51:43 +0200 Subject: [PATCH 1/3] added support for PUT method --- src/Symfony/Component/HttpFoundation/Request.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index ca496a9f311e0..b4e37011c7b8d 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -108,6 +108,13 @@ public function initialize(array $query = array(), array $request = array(), arr $this->server = new ServerBag($server); $this->headers = new HeaderBag($this->server->getHeaders()); + if ('application/x-www-form-urlencoded' == $this->server->get('CONTENT_TYPE') + && in_array(strtoupper($this->server->get('REQUEST_METHOD', 'GET'), array('PUT', 'DELETE')) + ) { + parse_str($this->getContent(), $data); + $this->request = new ParameterBag($data); + } + $this->content = $content; $this->languages = null; $this->charsets = null; From 08846af9e23e08e57825e1f6717fcc68ce72682e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 11 May 2011 10:30:57 +0200 Subject: [PATCH 2/3] [HttpFoundation] moved the PUT magic dance in createFromGlobals() --- .../Component/HttpFoundation/Request.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index b4e37011c7b8d..b42ca9bde03c5 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -108,13 +108,6 @@ public function initialize(array $query = array(), array $request = array(), arr $this->server = new ServerBag($server); $this->headers = new HeaderBag($this->server->getHeaders()); - if ('application/x-www-form-urlencoded' == $this->server->get('CONTENT_TYPE') - && in_array(strtoupper($this->server->get('REQUEST_METHOD', 'GET'), array('PUT', 'DELETE')) - ) { - parse_str($this->getContent(), $data); - $this->request = new ParameterBag($data); - } - $this->content = $content; $this->languages = null; $this->charsets = null; @@ -134,7 +127,16 @@ public function initialize(array $query = array(), array $request = array(), arr */ static public function createFromGlobals() { - return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); + + if ('application/x-www-form-urlencoded' == $request->server->get('CONTENT_TYPE') + && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET'), array('PUT', 'DELETE')) + ) { + parse_str($this->getContent(), $data); + $request->request = new ParameterBag($data); + } + + return $request; } /** From 0848604ce111d2e37f9ea1eb2240edf1e430b8e6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 May 2011 14:44:49 +0200 Subject: [PATCH 3/3] [HttpFoundation] fixed typo --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index b42ca9bde03c5..f871f43538446 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -130,7 +130,7 @@ static public function createFromGlobals() $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); if ('application/x-www-form-urlencoded' == $request->server->get('CONTENT_TYPE') - && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET'), array('PUT', 'DELETE')) + && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE')) ) { parse_str($this->getContent(), $data); $request->request = new ParameterBag($data);