|
|
@@ -350,11 +350,6 @@ class Hash
|
|
|
$count = count($path);
|
|
|
$last = $count - 1;
|
|
|
foreach ($path as $i => $key) {
|
|
|
- if ((is_numeric($key) && (int)$key > 0 || $key === '0') &&
|
|
|
- strpos($key, '0') !== 0
|
|
|
- ) {
|
|
|
- $key = (int)$key;
|
|
|
- }
|
|
|
if ($op === 'insert') {
|
|
|
if ($i === $last) {
|
|
|
$_list[$key] = $values;
|
|
|
@@ -370,7 +365,9 @@ class Hash
|
|
|
}
|
|
|
} elseif ($op === 'remove') {
|
|
|
if ($i === $last) {
|
|
|
- unset($_list[$key]);
|
|
|
+ if (is_array($_list)) {
|
|
|
+ unset($_list[$key]);
|
|
|
+ }
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
@@ -419,7 +416,7 @@ class Hash
|
|
|
if ($match && is_array($v)) {
|
|
|
if ($conditions) {
|
|
|
if (static::_matches($v, $conditions)) {
|
|
|
- if ($nextPath) {
|
|
|
+ if ($nextPath !== '') {
|
|
|
$data[$k] = static::remove($v, $nextPath);
|
|
|
} else {
|
|
|
unset($data[$k]);
|
|
|
@@ -431,7 +428,7 @@ class Hash
|
|
|
if (empty($data[$k])) {
|
|
|
unset($data[$k]);
|
|
|
}
|
|
|
- } elseif ($match && empty($nextPath)) {
|
|
|
+ } elseif ($match && $nextPath === '') {
|
|
|
unset($data[$k]);
|
|
|
}
|
|
|
}
|