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:
Dylan K. Taylor 2020-04-15 12:13:26 +01:00
parent a78133d0e3
commit 1755b25808

View File

@ -676,6 +676,7 @@ class Utils{
public static function recursiveUnlink(string $dir) : void{
if(is_dir($dir)){
$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){
if($object !== "." and $object !== ".."){
if(is_dir($dir . "/" . $object)){