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:
Mark Story 2012-12-14 18:17:23 -08:00
commit ff1bd276ae
2 changed files with 4 additions and 1 deletions

View file

@ -659,6 +659,9 @@ class HashTest extends CakeTestCase {
$result = Hash::extract($data, '1.Article.title');
$this->assertEquals(array('Second Article'), $result);
$result = Hash::extract(array(false), '{n}.Something.another_thing');
$this->assertEquals(array(), $result);
}
/**

View file

@ -117,7 +117,7 @@ class Hash {
}
foreach ($context[$_key] as $item) {
foreach ($item as $k => $v) {
foreach ((array)$item as $k => $v) {
if (self::_matchToken($k, $token)) {
$next[] = $v;
}