From 89a89427ffc006b1cdbe2203d456db95870d6481 Mon Sep 17 00:00:00 2001 From: nate Date: Tue, 22 Aug 2006 07:26:58 +0000 Subject: [PATCH] Fixing bug in Set::map for handling empty arrays git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3419 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/set.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cake/libs/set.php b/cake/libs/set.php index de8809406..4c4dc1038 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -105,7 +105,7 @@ class Set extends Object { } function __map($value, $class) { - if (Set::numeric(array_keys($value))) { + if (!empty($value) && Set::numeric(array_keys($value))) { $ret = array(); foreach ($value as $key => $val) { $ret[$key] = Set::__map($val, $class); @@ -114,6 +114,10 @@ class Set extends Object { $ret = new $class; } + if (empty($value)) { + return $ret; + } + $keys = array_keys($value); foreach ($value as $key => $val) { if (!is_numeric($key) && strlen($key) > 1) {