File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -19,20 +19,24 @@ public static function forget(&$array, $keys)
1919 {
2020 $ original = &$ array ;
2121 $ keys = (array ) $ keys ;
22+
2223 if (count ($ keys ) === 0 ) {
2324 return ;
2425 }
26+
2527 foreach ($ keys as $ key ) {
2628 // if the exact key exists in the top-level, remove it
2729 if (static ::exists ($ array , $ key )) {
2830 unset($ array [$ key ]);
31+
2932 continue ;
3033 }
3134
3235 $ parts = static ::explode ($ key );
3336
3437 // clean up before each pass
3538 $ array = &$ original ;
39+
3640 while (count ($ parts ) > 1 ) {
3741 $ part = array_shift ($ parts );
3842 if (isset ($ array [$ part ]) && is_array ($ array [$ part ])) {
@@ -41,6 +45,7 @@ public static function forget(&$array, $keys)
4145 continue 2 ;
4246 }
4347 }
48+
4449 unset($ array [array_shift ($ parts )]);
4550 }
4651 }
You can’t perform that action at this time.
0 commit comments