mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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
This commit is contained in:
parent
6f73e4fd76
commit
afebe2d418
1 changed files with 4 additions and 2 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue