From e4cf8a6937481e90cba2feaa6fc0fcb82aff9f54 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 1 May 2010 23:46:10 -0400 Subject: [PATCH] Fixing issue where 'data' could not be accessed with array access, there were tests in Dispatchers tests that expected this. --- cake/libs/cake_request.php | 5 ++++- cake/tests/cases/libs/cake_request.test.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cake/libs/cake_request.php b/cake/libs/cake_request.php index d059c9699..edafbf657 100644 --- a/cake/libs/cake_request.php +++ b/cake/libs/cake_request.php @@ -92,7 +92,7 @@ class CakeRequest implements ArrayAccess { 'mobile' => array('env' => 'HTTP_USER_AGENT', 'options' => array( 'Android', 'AvantGo', 'BlackBerry', 'DoCoMo', 'iPod', 'iPhone', 'J2ME', 'MIDP', 'NetFront', 'Nokia', 'Opera Mini', 'PalmOS', 'PalmSource', - 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'SonyEricsson', 'Symbian', 'UP\.Browser', + 'portalmmm', 'Plucker', 'ReqwirelessWeb', 'SonyEricsson', 'Symbian', 'UP\\.Browser', 'webOS', 'Windows CE', 'Xiino' )) ); @@ -522,6 +522,9 @@ class CakeRequest implements ArrayAccess { if ($name == 'url') { return $this->query; } + if ($name == 'data') { + return $this->data; + } return null; } diff --git a/cake/tests/cases/libs/cake_request.test.php b/cake/tests/cases/libs/cake_request.test.php index 9d90d0644..70ea7d9fe 100644 --- a/cake/tests/cases/libs/cake_request.test.php +++ b/cake/tests/cases/libs/cake_request.test.php @@ -560,6 +560,9 @@ class CakeRequestTestCase extends CakeTestCase { $request = new CakeRequest('some/path?one=something&two=else'); $this->assertTrue(isset($request['url']['one'])); + + $request->data = array('Post' => array('title' => 'something')); + $this->assertEqual($request['data']['Post']['title'], 'something'); } /**