From 6d0b9ca5bf43fc3a9c4d8501aba247c576ec352e Mon Sep 17 00:00:00 2001 From: sebastian Date: Mon, 15 Feb 2010 17:20:20 +0000 Subject: [PATCH] #2363 Malformed XML-RPC responses from storageServer --- .../src/modules/storageServer/var/MetaData.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/campcaster/src/modules/storageServer/var/MetaData.php b/campcaster/src/modules/storageServer/var/MetaData.php index da80cc475..25116150d 100644 --- a/campcaster/src/modules/storageServer/var/MetaData.php +++ b/campcaster/src/modules/storageServer/var/MetaData.php @@ -1001,7 +1001,7 @@ class MetaData { $node = XML_Util::createTagFromArray(array( 'namespace' => $predns, 'localPart' => $predicate, - 'attributes'=> $attrs, + 'attributes'=> $this->escapeAttr($attrs), 'content' => (is_null($object) ? $children : htmlspecialchars($object)), ), FALSE); // 'content' => (is_null($object) ? $children : htmlentities($object, ENT_COMPAT, 'UTF-8')), @@ -1073,7 +1073,21 @@ class MetaData { } return compact('attrs', 'children', 'nSpaces'); } - + + /** + * Escape array values to be used as XML attributes. + * + * @param array $attr + * @return array + */ + public function escapeAttr($attr) + { + foreach ($attr as $key => $val) { + $attr[$key] = XML_Util::replaceEntities($val, 1, 'UTF-8'); + } + return $attr; + } + /* ========================================================= test methods */ /**