mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
parent
25c7a27495
commit
fb0cc50700
2 changed files with 28 additions and 1 deletions
|
@ -1387,6 +1387,33 @@ class SetTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that extract() + matching can hit null things.
|
||||
*/
|
||||
public function testExtractMatchesNull() {
|
||||
$data = array(
|
||||
'Country' => array(
|
||||
array('name' => 'Canada'),
|
||||
array('name' => 'Australia'),
|
||||
array('name' => null),
|
||||
)
|
||||
);
|
||||
$result = Set::extract('/Country[name=/Canada|^$/]', $data);
|
||||
$expected = array(
|
||||
array(
|
||||
'Country' => array(
|
||||
'name' => 'Canada',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'Country' => array(
|
||||
'name' => null,
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testMatches method
|
||||
*
|
||||
|
|
|
@ -536,7 +536,7 @@ class Set {
|
|||
continue;
|
||||
}
|
||||
list(, $key, $op, $expected) = $match;
|
||||
if (!isset($data[$key])) {
|
||||
if (!(isset($data[$key]) || array_key_exists($key, $data))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue