diff --git a/nur_src/shutils.php b/nur_src/shutils.php index 95b1be7..768f00e 100644 --- a/nur_src/shutils.php +++ b/nur_src/shutils.php @@ -6,7 +6,9 @@ namespace nur; */ class shutils { static function ls_all(string $dir, ?string $pattern=null, int $sorting_order=SCANDIR_SORT_ASCENDING): array { - return array_filter(scandir($dir, $sorting_order), + $all = scandir($dir, $sorting_order); + if ($all === false) return []; + return array_filter($all, function ($file) use ($pattern) { if ($file === "." || $file === "..") return false; return $pattern === null || fnmatch($pattern, $file);