Fixing extraction of non-zero arrays with only one element and attribute selectors. Fixes

This commit is contained in:
Mark Story 2010-03-24 23:25:02 -04:00
parent cbb65ca85f
commit 4f4d3f9ffe
2 changed files with 4 additions and 3 deletions
cake
libs
tests/cases/libs

View file

@ -438,7 +438,8 @@ class Set extends Object {
$items = array($items);
} elseif (!isset($items[0])) {
$current = current($items);
if ((is_array($current) && count($items) <= 1) || !is_array($current)) {
$currentKey = key($items);
if (!is_array($current) || (is_array($current) && count($items) <= 1 && !is_numeric($currentKey))) {
$items = array($items);
}
}

View file

@ -1038,7 +1038,7 @@ class SetTest extends CakeTestCase {
$startingAtOne = array(
'Article' => array(
1=> array(
1 => array(
'id' => 1,
'approved' => 1,
),