Permalink
Browse files

fixing bug in Hash where array is not similar to the path required

  • Loading branch information...
1 parent 6f5ff4d commit 2266292594f1a795019982b40b82a6ae15339689 @dogmatic69 dogmatic69 committed Dec 14, 2012
Showing with 4 additions and 1 deletion.
  1. +3 −0 lib/Cake/Test/Case/Utility/HashTest.php
  2. +1 −1 lib/Cake/Utility/Hash.php
@@ -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);
}
/**
@@ -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;
}

0 comments on commit 2266292

Please sign in to comment.