From 7ae53cfd63ac9edf6e85792493a01b2be003e561 Mon Sep 17 00:00:00 2001 From: Anaggh S Date: Thu, 27 Feb 2020 02:58:05 +0530 Subject: [PATCH 1/2] Fix #1143 Add additional check to skip broken symlinks to avoid RuntimeException: SplFileInfo::getSize(): stat failed --- bl-kernel/helpers/filesystem.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bl-kernel/helpers/filesystem.class.php b/bl-kernel/helpers/filesystem.class.php index c7417afa..9cc0261c 100644 --- a/bl-kernel/helpers/filesystem.class.php +++ b/bl-kernel/helpers/filesystem.class.php @@ -268,7 +268,7 @@ class Filesystem { /** * Get Size of file or directory in bytes * @param [string] $fileOrDirectory - * @return [int|bool [bytes or false on error] + * @return [int|bool] [bytes or false on error] */ public static function getSize($fileOrDirectory) { // Files @@ -278,8 +278,10 @@ class Filesystem { // Directories if (file_exists($fileOrDirectory)) { $size = 0; - foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory)) as $file){ - $size += $file->getSize(); + foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fileOrDirectory, FilesystemIterator::SKIP_DOTS)) as $file){ + if (file_exists($file)) { + $size += $file->getSize(); + } } return $size; } From bbdc8afcaf3abae26c799cb65cfc9d60da290ed5 Mon Sep 17 00:00:00 2001 From: Anaggh S Date: Thu, 27 Feb 2020 03:08:27 +0530 Subject: [PATCH 2/2] Fix PHP 7.4 "Deprecated: Array and string offset access syntax with curly braces is deprecated" --- bl-kernel/helpers/text.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index 9f7093ea..2a53cebd 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -116,7 +116,7 @@ class Text { $characteres = "1234567890abcdefghijklmnopqrstuvwxyz!@#%^&*"; $text = ''; for($i=0; $i<$length; $i++) { - $text .= $characteres{rand(0,41)}; + $text .= $characteres[rand(0,41)]; } return $text; }