diff --git a/Auth/Auth.php b/Auth/Auth.php index 6f429b4fc..468fd9aa2 100644 --- a/Auth/Auth.php +++ b/Auth/Auth.php @@ -70,17 +70,17 @@ class Auth /** * Authenticates user. * - * @return mixed + * @return int * * @since 1.0.0 * @author Dennis Eichhorn */ - public function authenticate() + public function authenticate() : int { $uid = $this->session->get('UID'); - if ($uid === null) { - $uid = false; + if (empty($uid)) { + return 0; } return $uid; diff --git a/Localization/L11nManager.php b/Localization/L11nManager.php index b4b6e43d8..6ed90d66f 100644 --- a/Localization/L11nManager.php +++ b/Localization/L11nManager.php @@ -59,7 +59,7 @@ class L11nManager * @since 1.0.0 * @author Dennis Eichhorn */ - public function __construct(LoggerInterface $logger) + public function __construct(LoggerInterface $logger = null) { $this->logger = $logger; } @@ -179,9 +179,11 @@ class L11nManager $this->loadLanguage($code, $module, $class::getLocalization($code, $theme)); if (!isset($this->language[$code][$module][$translation])) { - $this->logger->warning(FileLogger::MSG_FULL, [ - 'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.', - ]); + if(isset($this->logger)) { + $this->logger->warning(FileLogger::MSG_FULL, [ + 'message' => 'Undefined translation for \'' . $code . '/' . $module . '/' . $translation . '\'.', + ]); + } return 'ERROR'; } diff --git a/Log/FileLogger.php b/Log/FileLogger.php index 77b31acbb..50c3c9545 100644 --- a/Log/FileLogger.php +++ b/Log/FileLogger.php @@ -311,7 +311,7 @@ class FileLogger implements LoggerInterface private function write(string $message) /* : void */ { $this->createFile(); - if(!is_readable($this->path)) { + if(!is_writable($this->path)) { return; } diff --git a/System/File/Local/File.php b/System/File/Local/File.php index fed52659b..7271bd188 100644 --- a/System/File/Local/File.php +++ b/System/File/Local/File.php @@ -350,7 +350,7 @@ class File extends FileAbstract implements FileInterface Directory::create(dirname($path), 0644, true); } - if(!is_writable($path)) { + if(!is_writable(dirname($path))) { return false; } diff --git a/Utils/Compression/LZW.php b/Utils/Compression/LZW.php index 2f0e3bcda..0e296beb0 100644 --- a/Utils/Compression/LZW.php +++ b/Utils/Compression/LZW.php @@ -82,7 +82,7 @@ class LZW implements CompressionInterface } $w = chr($compressed[0]); - $result = $w; + $result = $dictionary[$compressed[0]]; $count = count($compressed); for ($i = 1; $i < $count; $i++) {