mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing issues in Set::check() with implicit array-to-string casting
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6436 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
28545feec3
commit
1db0c07852
2 changed files with 8 additions and 3 deletions
|
@ -537,9 +537,9 @@ class Set extends Object {
|
|||
$key = intval($key);
|
||||
}
|
||||
if ($i == count($path) - 1) {
|
||||
return isset($data[$key]);
|
||||
return (is_array($data) && array_key_exists($key, $data));
|
||||
} else {
|
||||
if (!isset($data[$key])) {
|
||||
if (!is_array($data) && array_key_exists($key, $data)) {
|
||||
return false;
|
||||
}
|
||||
$data =& $data[$key];
|
||||
|
|
|
@ -1021,6 +1021,11 @@ class SetTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testStrictKeyCheck() {
|
||||
$set = new Set(array('a' => 'hi'));
|
||||
$this->assertFalse($set->check('a.b'));
|
||||
}
|
||||
|
||||
function __flatten($results, $key = null) {
|
||||
$stack = array();
|
||||
foreach ($results as $k => $r) {
|
||||
|
|
Loading…
Reference in a new issue