mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #1027 from dogmatic69/hash-invalid-foreach
fixing bug in Hash where array is not similar to the path required fixes #3466
This commit is contained in:
commit
ff1bd276ae
2 changed files with 4 additions and 1 deletions
|
@ -659,6 +659,9 @@ class HashTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = Hash::extract($data, '1.Article.title');
|
$result = Hash::extract($data, '1.Article.title');
|
||||||
$this->assertEquals(array('Second Article'), $result);
|
$this->assertEquals(array('Second Article'), $result);
|
||||||
|
|
||||||
|
$result = Hash::extract(array(false), '{n}.Something.another_thing');
|
||||||
|
$this->assertEquals(array(), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($context[$_key] as $item) {
|
foreach ($context[$_key] as $item) {
|
||||||
foreach ($item as $k => $v) {
|
foreach ((array)$item as $k => $v) {
|
||||||
if (self::_matchToken($k, $token)) {
|
if (self::_matchToken($k, $token)) {
|
||||||
$next[] = $v;
|
$next[] = $v;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue