mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
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:
parent
f762385bf6
commit
89a89427ff
1 changed files with 5 additions and 1 deletions
|
@ -105,7 +105,7 @@ class Set extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __map($value, $class) {
|
function __map($value, $class) {
|
||||||
if (Set::numeric(array_keys($value))) {
|
if (!empty($value) && Set::numeric(array_keys($value))) {
|
||||||
$ret = array();
|
$ret = array();
|
||||||
foreach ($value as $key => $val) {
|
foreach ($value as $key => $val) {
|
||||||
$ret[$key] = Set::__map($val, $class);
|
$ret[$key] = Set::__map($val, $class);
|
||||||
|
@ -114,6 +114,10 @@ class Set extends Object {
|
||||||
$ret = new $class;
|
$ret = new $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($value)) {
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
$keys = array_keys($value);
|
$keys = array_keys($value);
|
||||||
foreach ($value as $key => $val) {
|
foreach ($value as $key => $val) {
|
||||||
if (!is_numeric($key) && strlen($key) > 1) {
|
if (!is_numeric($key) && strlen($key) > 1) {
|
||||||
|
|
Loading…
Reference in a new issue