From cda0ce47273dd8778cca91d886eb29c77abf554c Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Sun, 24 Oct 2010 22:42:05 -0200 Subject: [PATCH] Testing the build of XML. If it is invalid will generate a Exception. --- .../libs/controller/components/request_handler.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index d8a50c3e4..93f11814a 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -175,13 +175,15 @@ class RequestHandlerComponent extends Component { if (!class_exists('Xml')) { App::import('Core', 'Xml'); } - $xml = Xml::build(trim(file_get_contents('php://input'))); + try { + $xml = Xml::build(trim(file_get_contents('php://input'))); - if (isset($xml->data)) { - $controller->data = Xml::toArray($xml->data); - } else { - $controller->data = Xml::toArray($xml); - } + if (isset($xml->data)) { + $controller->data = Xml::toArray($xml->data); + } else { + $controller->data = Xml::toArray($xml); + } + } catch (Exception $e) {} } }