diff --git a/common.php b/common.php index a89a8484..8bedc808 100644 --- a/common.php +++ b/common.php @@ -88,7 +88,7 @@ if (!empty($CONF['language_hook']) && function_exists($CONF['language_hook'])) { Config::write('__LANG', $PALANG); if (!defined('POSTFIXADMIN_CLI')) { - if (!isset($CONF) || !isset($PALANG)) { + if (!isset($PALANG)) { die("environment not setup correctly"); } require_once(__DIR__ . '/lib/smarty/libs/Autoloader.php'); diff --git a/composer.json b/composer.json index ce6ad788..48095351 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "lint": "@php ./vendor/bin/parallel-lint --exclude vendor/ --exclude lib/block_random_int.php --exclude lib/array_column.php .", "test": "@php ./vendor/bin/phpunit --coverage-clover ./clover.xml tests/", "test-fixup": "mkdir -p templates_c ; test -f config.local.php || touch config.local.php", - "psalm": "@php ./vendor/bin/psalm --show-info=false " + "psalm": "@php ./vendor/bin/psalm --no-cache --show-info=false " }, "require": { "php": ">=7.0" diff --git a/model/Login.php b/model/Login.php index 5a9ae8fe..80abbba6 100644 --- a/model/Login.php +++ b/model/Login.php @@ -36,7 +36,7 @@ class Login { $crypt_password = pacrypt($password, $row['password']); } catch (\Exception $e) { error_log("Error while trying to call pacrypt()"); - error_log($e); + error_log("" . $e); hash_equals("not", "comparable"); return false; // just refuse to login? } @@ -49,7 +49,7 @@ class Login { $x = pacrypt('abc', 'def'); } catch (\Exception $e) { error_log("Error trying to call pacrypt()"); - error_log($e); + error_log("" . $e); } return hash_equals('not', 'comparable'); diff --git a/psalm.xml b/psalm.xml index ebf0cc59..3fca0ec0 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,7 @@ + diff --git a/public/list-virtual.php b/public/list-virtual.php index ae98ca8b..ed8e112a 100644 --- a/public/list-virtual.php +++ b/public/list-virtual.php @@ -49,10 +49,6 @@ if (isset($_POST['search']) && is_array($_POST['search'])) { $search = $_GET['search']; } -if (!is_array($search)) { - die(Config::Lang('invalid_parameter')); -} - if (count($list_domains) == 0) { if (authentication_has_role('global-admin')) { flash_error($PALANG['no_domains_exist']); diff --git a/public/setup.php b/public/setup.php index fad981a2..a83508bb 100644 --- a/public/setup.php +++ b/public/setup.php @@ -545,7 +545,7 @@ function create_admin($values) { } /** - * @return array['info' => string[], 'warn' => string[], 'error' => string[] ] + * @return array like: ['info' => string[], 'warn' => string[], 'error' => string[] ] */ function do_software_environment_check() { $CONF = Config::getInstance()->getAll(); diff --git a/public/users/password-recover.php b/public/users/password-recover.php index 5a4d170b..19b29232 100644 --- a/public/users/password-recover.php +++ b/public/users/password-recover.php @@ -108,7 +108,7 @@ if ($_SERVER['REQUEST_METHOD'] === "POST") { // throttle password reset requests to prevent brute force attack $elapsed_time = microtime(true) - $start_time; if ($elapsed_time < 2 * pow(10, 6)) { - usleep(2 * pow(10, 6) - $elapsed_time); + usleep( (int) ( 2 * pow(10, 6) - $elapsed_time ) ); } flash_info(Config::Lang('pPassword_recovery_processed')); diff --git a/public/vacation.php b/public/vacation.php index 011e0e76..36558c01 100644 --- a/public/vacation.php +++ b/public/vacation.php @@ -142,7 +142,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { } if (isset($choice_of_reply[$tInterval_Time])) { - $fInterval_Time = $tInterval_Time; + $fInterval_Time = (int) $tInterval_Time; } else { $fInterval_Time = 0; }