From e183e91b178995564c56c2379fa02b331c223705 Mon Sep 17 00:00:00 2001 From: mark_story Date: Tue, 14 Aug 2012 12:40:33 -0400 Subject: [PATCH] Make CakeRequest work with content-type headers that include a charset. Refs #3113 --- lib/Cake/Network/CakeRequest.php | 2 +- lib/Cake/Test/Case/Network/CakeRequestTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Network/CakeRequest.php b/lib/Cake/Network/CakeRequest.php index cadbbbd0c..1ac08cf8f 100644 --- a/lib/Cake/Network/CakeRequest.php +++ b/lib/Cake/Network/CakeRequest.php @@ -165,7 +165,7 @@ class CakeRequest implements ArrayAccess { $this->data = $_POST; } elseif ($this->is('put') || $this->is('delete')) { $this->data = $this->_readInput(); - if (env('CONTENT_TYPE') === 'application/x-www-form-urlencoded') { + if (strpos(env('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0) { parse_str($this->data, $this->data); } } diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php index 8ef0e1868..86f6f6039 100644 --- a/lib/Cake/Test/Case/Network/CakeRequestTest.php +++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php @@ -233,7 +233,7 @@ class CakeRequestTest extends CakeTestCase { */ public function testPutParsing() { $_SERVER['REQUEST_METHOD'] = 'PUT'; - $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; + $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=UTF-8'; $data = array('data' => array( 'Article' => array('title')