From 382a63651d6ecd55fa4d118f283ced0b5b296df8 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 2 Jul 2007 17:13:35 +0000 Subject: [PATCH] Updating Set::reverse() Corrected undefined variable git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5372 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/set.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cake/libs/set.php b/cake/libs/set.php index d46adb6a2..e11ca23b0 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -684,20 +684,19 @@ class Set extends Object { if ($keys[$i] == '__identity__') { unset($object[$keys[$i]]); } elseif (is_array($object[$keys[$i]])) { - $keys1 = array_keys($object[$keys[$i]]); - $count1 = count($keys1); - for ($ii = 0; $ii < $count1; $ii++) { - $merge[$keys[$i]][$ii] = Set::reverse($object[$keys[$i]][$ii]); - } - unset($object[$keys[$i]]); - } elseif (is_object($object[$keys[$i]])) { - $object1 = get_object_vars($one[$keys[$i]]); - $keys1 = array_keys($object1); + $keys1 = array_keys($object[$keys[$i]]); $count1 = count($keys1); for ($ii = 0; $ii < $count1; $ii++) { - $merge[$keys[$i]][$ii] = Set::reverse($object1[$keys1[$i]][$ii]); + if (is_object($object[$keys[$i]][$keys1[$ii]])) { + $merge[$keys[$i]][$keys1[$ii]] = Set::reverse($object[$keys[$i]][$keys1[$ii]]); + } else { + $merge[$keys[$i]][$keys1[$ii]] = $object[$keys[$i]][$keys1[$ii]]; + } } unset($object[$keys[$i]]); + } elseif (is_object($object[$keys[$i]])) { + $merge[$keys[$i]] = Set::reverse($object[$keys[$i]]); + unset($object[$keys[$i]]); } } } @@ -709,4 +708,4 @@ class Set extends Object { } } } -?> \ No newline at end of file +?>