Merge pull request #1145 from anaggh/master

Use try catch instead
This commit is contained in:
Diego Najar 2020-02-28 10:12:40 +01:00 committed by GitHub
commit f42961dd80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -279,9 +279,11 @@ class Filesystem {
if (file_exists($fileOrDirectory)) {
$size = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file){
if (file_exists($file)) {
$size += $file->getSize();
}
try {
$size += $file->getSize();
} catch (Exception $e) {
// SplFileInfo::getSize RuntimeException will be thrown on broken symlinks/errors
}
}
return $size;
}