diff --git a/lib/Cake/Test/Case/Utility/HashTest.php b/lib/Cake/Test/Case/Utility/HashTest.php index 059de1839..61766ed62 100644 --- a/lib/Cake/Test/Case/Utility/HashTest.php +++ b/lib/Cake/Test/Case/Utility/HashTest.php @@ -170,6 +170,14 @@ class HashTest extends CakeTestCase { * return void */ public function testGet() { + $data = array('abc', 'def'); + + $result = Hash::get($data, '0'); + $this->assertEquals('abc', $result); + + $result = Hash::get($data, '1'); + $this->assertEquals('def', $result); + $data = self::articleData(); $result = Hash::get(array(), '1.Article.title'); diff --git a/lib/Cake/Utility/Hash.php b/lib/Cake/Utility/Hash.php index 278a01aa9..8974ef8d7 100644 --- a/lib/Cake/Utility/Hash.php +++ b/lib/Cake/Utility/Hash.php @@ -39,7 +39,7 @@ class Hash { * @return mixed The value fetched from the array, or null. */ public static function get(array $data, $path) { - if (empty($data) || empty($path)) { + if (empty($data)) { return null; } if (is_string($path)) {