mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 14:05:35 +00:00
Utils: make explicit assumption about result of scandir() in recursiveUnlink()
TODO: this assumption might be flawed in the case of threading...
This commit is contained in:
parent
a78133d0e3
commit
1755b25808
@ -676,6 +676,7 @@ class Utils{
|
|||||||
public static function recursiveUnlink(string $dir) : void{
|
public static function recursiveUnlink(string $dir) : void{
|
||||||
if(is_dir($dir)){
|
if(is_dir($dir)){
|
||||||
$objects = scandir($dir, SCANDIR_SORT_NONE);
|
$objects = scandir($dir, SCANDIR_SORT_NONE);
|
||||||
|
if($objects === false) throw new AssumptionFailedError("scandir() shouldn't return false when is_dir() returns true");
|
||||||
foreach($objects as $object){
|
foreach($objects as $object){
|
||||||
if($object !== "." and $object !== ".."){
|
if($object !== "." and $object !== ".."){
|
||||||
if(is_dir($dir . "/" . $object)){
|
if(is_dir($dir . "/" . $object)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user