From af575027daa081eaca1227c25e8b5a7b5b9d7d1c Mon Sep 17 00:00:00 2001 From: Rachman Chavik Date: Tue, 13 Mar 2012 12:45:06 +0700 Subject: [PATCH] fix Set::sort() for issue in previous commit --- lib/Cake/Utility/Set.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index d4bf7be7b..181f1b088 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -1089,10 +1089,14 @@ class Set { $keys = array_unique($keys); foreach ($keys as $k) { - if (!$numeric) { - $sorted[$originalKeys[$k]] = $data[$originalKeys[$k]]; - } else { + if ($numeric) { $sorted[] = $data[$k]; + } else { + if (isset($originalKeys[$k])) { + $sorted[$originalKeys[$k]] = $data[$originalKeys[$k]]; + } else { + $sorted[$k] = $data[$k]; + } } } return $sorted;