mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix Hash::remove() removing data even if the path is not matched
This commit is contained in:
parent
d715c6f2de
commit
b70cb132fd
2 changed files with 13 additions and 1 deletions
|
@ -1488,6 +1488,18 @@ class HashTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$array = array(
|
||||
0 => 'foo',
|
||||
1 => array(
|
||||
0 => 'baz'
|
||||
)
|
||||
);
|
||||
$expected = $array;
|
||||
$result = Hash::remove($array, '{n}.part');
|
||||
$this->assertEquals($expected, $result);
|
||||
$result = Hash::remove($array, '{n}.{n}.part');
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -355,7 +355,7 @@ class Hash {
|
|||
if (empty($data[$k])) {
|
||||
unset($data[$k]);
|
||||
}
|
||||
} elseif ($match) {
|
||||
} elseif ($match && empty($nextPath)) {
|
||||
unset($data[$k]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue