Found the bug and fixed it, closes #4693

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6977 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-05-20 00:50:06 +00:00
parent e1e71b6d93
commit 1224845967
2 changed files with 14 additions and 13 deletions

View file

@ -265,10 +265,12 @@ class ContainableBehavior extends ModelBehavior {
$children[$key] = (array)$val;
}
}
$keys = array_keys($children);
if ($keys && isset($children[0])) {
$keys = array_values($children);
$keys = am(array_values($children), $keys);
}
foreach ($keys as $i => $key) {
if (is_array($key)) {
continue;
@ -291,7 +293,7 @@ class ContainableBehavior extends ModelBehavior {
$key = $option;
$optionKey = true;
}
if ($optionKey) {
if ($optionKey && isset($children[$key])) {
$keep[$name][$key] = array_merge((isset($keep[$name][$key]) ? $keep[$name][$key] : array()), (array) $children[$key]);
unset($children[$key]);
}