From afebe2d4180091ec14a925656facbed61920e77a Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 3 Feb 2008 04:53:52 +0000 Subject: [PATCH] Fixing XML text node conversion support in Set class git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6430 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/set.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cake/libs/set.php b/cake/libs/set.php index 284d5b8dd..e727728ba 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -790,7 +790,7 @@ class Set extends Object { */ function reverse($object) { $out = array(); - if (is_a($object, 'xmlnode') || is_a($object, 'XMLNode')) { + if (is_a($object, 'XMLNode')) { if (isset($object->name) && isset($object->children)) { if ($object->name === '#document' && !empty($object->children)) { $out = Set::reverse($object->children[0]); @@ -801,13 +801,15 @@ class Set extends Object { $childName = Inflector::camelize($child->name); if (count($child->children) > 1 && isset($child->name)) { $children[$childName][] = Set::reverse($child); + } elseif ($child->name == '#text') { + $object->value = $child->value; } else { $children = array_merge($children, Set::reverse($child)); } } } - $camelName = Inflector::camelize($object->name); + if (!empty($object->attributes) && !empty($children)) { $out[$camelName] = array_merge($object->attributes, $children); } elseif (!empty($object->attributes) && !empty($object->value)) {