diff --git a/cake/libs/set.php b/cake/libs/set.php index 4376f5c05..bed03379a 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -374,12 +374,12 @@ class Set extends Object { $data = $path; $path = $tmp; } - if (empty($data)) { - return array(); - } if (strpos($path, '/') === false) { return Set::classicExtract($data, $path); } + if (empty($data)) { + return array(); + } if ($path === '/') { return $data; } diff --git a/cake/tests/cases/libs/set.test.php b/cake/tests/cases/libs/set.test.php index ed2f4f04c..81f884394 100644 --- a/cake/tests/cases/libs/set.test.php +++ b/cake/tests/cases/libs/set.test.php @@ -1052,15 +1052,17 @@ class SetTest extends CakeTestCase { */ function testSetExtractReturnsEmptyArray() { - $this->assertEqual(Set::extract(array(), '/Post/id'), array()); + $this->assertIdentical(Set::extract(array(), '/Post/id'), array()); - $this->assertEqual(Set::extract('/Post/id', array()), array()); + $this->assertIdentical(Set::extract('/Post/id', array()), array()); - $this->assertEqual(Set::extract('/Post/id', array( + $this->assertIdentical(Set::extract('/Post/id', array( array('Post' => array('name' => 'bob')), array('Post' => array('name' => 'jim')) )), array()); + $this->assertIdentical(Set::extract(array(), 'Message.flash'), null); + } /** * testClassicExtract method