From da0d9390685a9c9340087e45c668db4b0edfe725 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Tue, 28 Feb 2023 06:54:20 +0900 Subject: [PATCH] First phpstan strict check --- vendor/composer/installed.php | 4 ++-- www/configs/config.master.php | 8 +++++--- www/configs/config.php | 1 - www/lib/CoreLibs/ACL/Login.php | 11 ++++++----- www/lib/CoreLibs/Basic.php | 3 --- www/lib/CoreLibs/Create/Session.php | 1 + 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index ebac11ef..92079e23 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'f564c27319dd258010ae5ce4cfb55a40817a3d9f', + 'reference' => '537bc0a4773bf70d8b4ea978185dbd4fc30c640d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'f564c27319dd258010ae5ce4cfb55a40817a3d9f', + 'reference' => '537bc0a4773bf70d8b4ea978185dbd4fc30c640d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/www/configs/config.master.php b/www/configs/config.master.php index 355ab937..5194cf14 100644 --- a/www/configs/config.master.php +++ b/www/configs/config.master.php @@ -233,11 +233,13 @@ if ( } // set SSL on $is_secure = false; -if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { +if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') { $is_secure = true; } elseif ( - !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || - !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on' + !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' || + !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && + $_SERVER['HTTP_X_FORWARDED_SSL'] === 'on' ) { $is_secure = true; } diff --git a/www/configs/config.php b/www/configs/config.php index df7f3b95..1a6d749a 100644 --- a/www/configs/config.php +++ b/www/configs/config.php @@ -69,7 +69,6 @@ foreach (['admin', 'frontend'] as $folder) { } } // if content path is empty, fallback is default -/** @phpstan-ignore-next-line can be empty */ if (empty($folder)) { $folder = 'default'; } diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index c8be7b2f..ee37589f 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -1048,7 +1048,7 @@ class Login $res = $this->db->dbReturnRow($q); if ( !is_array($res) || - (is_array($res) && empty($res['edit_user_id'])) + empty($res['edit_user_id']) ) { // username wrong $this->login_error = 201; @@ -1068,9 +1068,11 @@ class Login } if ( !is_array($res) || - (is_array($res) && - (empty($res['edit_user_id']) || - !$this->loginPasswordCheck($res['old_password_hash'], $this->pw_old_password))) + empty($res['edit_user_id']) || + !$this->loginPasswordCheck( + $res['old_password_hash'], + $this->pw_old_password + ) ) { // old password wrong $this->login_error = 202; @@ -1794,7 +1796,6 @@ EOM; // check that numeric, positive numeric, not longer than max input string lenght // and not short than min password length if ( - is_numeric($length) && $length >= $this->password_min_length_max && $length <= $this->password_max_length && $length <= 255 diff --git a/www/lib/CoreLibs/Basic.php b/www/lib/CoreLibs/Basic.php index c902bde5..27d0c3eb 100644 --- a/www/lib/CoreLibs/Basic.php +++ b/www/lib/CoreLibs/Basic.php @@ -672,9 +672,6 @@ class Basic public static function arrayToString(array $array, string $connect_char): string { trigger_error('Method ' . __METHOD__ . ' is deprecated, use join()', E_USER_DEPRECATED); - if (!is_array($array)) { - $array = []; - } return join($connect_char, $array); } diff --git a/www/lib/CoreLibs/Create/Session.php b/www/lib/CoreLibs/Create/Session.php index f1d20f6e..d9e8be0c 100644 --- a/www/lib/CoreLibs/Create/Session.php +++ b/www/lib/CoreLibs/Create/Session.php @@ -341,6 +341,7 @@ class Session if (isset($_SESSION[$name])) { return $_SESSION[$name]; } + return []; } /**