Skip to content

Commit

Permalink
fixing bug in Hash where array is not similar to the path required
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Dec 14, 2012
1 parent 6f5ff4d commit 2266292
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Cake/Test/Case/Utility/HashTest.php
Expand Up @@ -659,6 +659,9 @@ public function testExtractBasic() {

$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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Hash.php
Expand Up @@ -117,7 +117,7 @@ public static function extract(array $data, $path) {
}

foreach ($context[$_key] as $item) {
foreach ($item as $k => $v) {
foreach ((array)$item as $k => $v) {
if (self::_matchToken($k, $token)) {
$next[] = $v;
}
Expand Down

0 comments on commit 2266292

Please sign in to comment.