diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index 70ef9b20c..fbbf01afa 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -219,10 +219,10 @@ class RequestHandlerComponent extends Object { } $xml = new Xml(trim(file_get_contents('php://input'))); - if (is_object($xml->child('data')) && count($xml->children) == 1) { - $controller->data = $xml->child('data'); + if (count($xml->children) == 1 && is_object($dataNode = $xml->child('data'))) { + $controller->data = $dataNode->toArray(); } else { - $controller->data = $xml; + $controller->data = $xml->toArray(); } } } diff --git a/cake/tests/cases/libs/controller/components/request_handler.test.php b/cake/tests/cases/libs/controller/components/request_handler.test.php index 9f979c323..a05bd2177 100644 --- a/cake/tests/cases/libs/controller/components/request_handler.test.php +++ b/cake/tests/cases/libs/controller/components/request_handler.test.php @@ -241,8 +241,8 @@ class RequestHandlerComponentTest extends CakeTestCase { $_SERVER['REQUEST_METHOD'] = 'PUT'; $_SERVER['CONTENT_TYPE'] = 'application/xml'; $this->RequestHandler->startup($this->Controller); - $this->assertTrue(is_object($this->Controller->data)); - $this->assertEqual(strtolower(get_class($this->Controller->data)), 'xml'); + $this->assertTrue(is_array($this->Controller->data)); + $this->assertFalse(is_object($this->Controller->data)); } /** @@ -254,8 +254,8 @@ class RequestHandlerComponentTest extends CakeTestCase { $_SERVER['REQUEST_METHOD'] = 'PUT'; $_SERVER['CONTENT_TYPE'] = 'application/xml; charset=UTF-8'; $this->RequestHandler->startup($this->Controller); - $this->assertTrue(is_object($this->Controller->data)); - $this->assertEqual(strtolower(get_class($this->Controller->data)), 'xml'); + $this->assertTrue(is_array($this->Controller->data)); + $this->assertFalse(is_object($this->Controller->data)); } /**