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
This commit is contained in:
nate 2006-08-22 07:26:58 +00:00
parent f762385bf6
commit 89a89427ff

View file

@ -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) {