mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-28 06:46:30 +00:00
Fixing extraction of non-zero arrays with only one element and attribute selectors. Fixes #475
This commit is contained in:
parent
cbb65ca85f
commit
4f4d3f9ffe
2 changed files with 4 additions and 3 deletions
cake
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1038,7 +1038,7 @@ class SetTest extends CakeTestCase {
|
|||
|
||||
$startingAtOne = array(
|
||||
'Article' => array(
|
||||
1=> array(
|
||||
1 => array(
|
||||
'id' => 1,
|
||||
'approved' => 1,
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue