mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
Fixes #4485
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6666 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
ba0a60fdbd
commit
f6c30745fe
2 changed files with 7 additions and 0 deletions
|
@ -384,6 +384,9 @@ class Set extends Object {
|
|||
* @access public
|
||||
*/
|
||||
function extract($path, $data = null, $options = array()) {
|
||||
if (empty($data) && is_string($path) && $path{0} == '/') {
|
||||
return array();
|
||||
}
|
||||
if (is_string($data) && $data{0} == '/') {
|
||||
$tmp = $path;
|
||||
$path = $data;
|
||||
|
|
|
@ -506,6 +506,10 @@ class SetTest extends UnitTestCase {
|
|||
$expected = array($common[0]['Comment'][1]);
|
||||
$r = Set::extract($common, '/Comment[1]/.[2]');
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
$expected = array();
|
||||
$r = Set::extract('/User/id', array());
|
||||
$this->assertEqual($r, $expected);
|
||||
}
|
||||
/**
|
||||
* undocumented function
|
||||
|
|
Loading…
Add table
Reference in a new issue