diff --git a/www/configs/config.master.php b/www/configs/config.master.php index 1dfa36c0..004a5a4c 100644 --- a/www/configs/config.master.php +++ b/www/configs/config.master.php @@ -226,7 +226,7 @@ if ( ((is_array($DB_CONFIG) && !count($DB_CONFIG)) || !is_array($DB_CONFIG) || // has DB CONFIG but no match - (is_array($DB_CONFIG) && count($DB_CONFIG) && !isset($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']]))) + empty($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']])) ) ) { echo 'No matching DB config found for: "' . HOST_NAME . '" . Contact Administrator'; diff --git a/www/lib/CoreLibs/ACL/Login.php b/www/lib/CoreLibs/ACL/Login.php index 0167c370..eafade79 100644 --- a/www/lib/CoreLibs/ACL/Login.php +++ b/www/lib/CoreLibs/ACL/Login.php @@ -367,8 +367,14 @@ class Login extends \CoreLibs\DB\IO } // first, errors on missing encryption if ( + // below is all deprecated. all the ones below will always be true + // all the crypt standards are always set + // FIXME: remove this error code + /** @phpstan-ignore-next-line Why? */ (preg_match("/^\\$2(a|y)\\$/", $hash) && CRYPT_BLOWFISH != 1) || + /** @phpstan-ignore-next-line Why? */ (preg_match("/^\\$1\\$/", $hash) && CRYPT_MD5 != 1) || + /** @phpstan-ignore-next-line Why? */ (preg_match("/^\\$[0-9A-Za-z.]{12}$/", $hash) && CRYPT_STD_DES != 1) ) { // this means password cannot be decrypted because of missing crypt methods diff --git a/www/lib/CoreLibs/Combined/DateTime.php b/www/lib/CoreLibs/Combined/DateTime.php index 3e3174ce..574db210 100644 --- a/www/lib/CoreLibs/Combined/DateTime.php +++ b/www/lib/CoreLibs/Combined/DateTime.php @@ -128,7 +128,8 @@ class DateTime $timestamp .= '.' . $matches[10]; } if ($negative) { - $timestamp *= -1; + // cast to flaot so we can do a negative multiplication + $timestamp = (float)$timestamp * -1; } return $timestamp; } else { diff --git a/www/lib/CoreLibs/DB/IO.php b/www/lib/CoreLibs/DB/IO.php index 311dc884..b0dca78b 100644 --- a/www/lib/CoreLibs/DB/IO.php +++ b/www/lib/CoreLibs/DB/IO.php @@ -1357,7 +1357,7 @@ class IO /** * All possible parameter names for dbVersionInfo - * @return array List of all parameter names + * @return array List of all parameter names */ public function dbVersionInfoParameters(): array { @@ -2870,7 +2870,7 @@ class IO */ public function dbGetInsertPKName(): string { - return $this->insert_id_pk_name ?? ''; + return $this->insert_id_pk_name; } /** diff --git a/www/lib/CoreLibs/DB/SQL/PgSQL.php b/www/lib/CoreLibs/DB/SQL/PgSQL.php index fa368421..405f7945 100644 --- a/www/lib/CoreLibs/DB/SQL/PgSQL.php +++ b/www/lib/CoreLibs/DB/SQL/PgSQL.php @@ -617,7 +617,7 @@ class PgSQL implements Interface\SqlFunctions /** * Returns all parameters that are possible from the db_version - * @return array Parameter key names from pg_version + * @return array Parameter key names from pg_version */ public function __dbVersionInfoParameterList(): array { @@ -718,18 +718,19 @@ class PgSQL implements Interface\SqlFunctions } /** - * Returns any server setting, if no connection or empty parameter returns - * empty string - * @param string $parameter Parameter to query - * @return string Settings value as string + * Returns any server setting + * if no connection or empty parameter or other error returns false + * else returns a string + * @param string $parameter Parameter to query + * @return string|bool Settings value as string */ - public function __dbParameter(string $parameter): string + public function __dbParameter(string $parameter) { if ($this->dbh === false || is_bool($this->dbh)) { - return ''; + return false; } if (empty($parameter)) { - return ''; + return false; } return pg_parameter_status($this->dbh, $parameter); } diff --git a/www/lib/CoreLibs/Output/Form/Generate.php b/www/lib/CoreLibs/Output/Form/Generate.php index 78923e06..9bfec81f 100644 --- a/www/lib/CoreLibs/Output/Form/Generate.php +++ b/www/lib/CoreLibs/Output/Form/Generate.php @@ -867,7 +867,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO $save = $this->l->__('Update'); } // print the old_school hidden if requestet - if ($old_school_hidden == 1) { + if ($old_school_hidden == 1) { /** @phpstan-ignore-line Unclear logic */ $pk_name = $this->int_pk_name; $pk_value = $this->table_array[$this->int_pk_name]['value']; } @@ -2488,7 +2488,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO } // push in an empty line of this type, but only if we have a delete key that is also filled - if (isset($data['delete_name']) && !empty($data['delete_name'])) { + if (!empty($data['delete_name'])) { $data['content'][] = $proto; // we also need the pos add or we through an error in smarty $data['pos'][] = [ diff --git a/www/lib/Error.Handling.php b/www/lib/Error.Handling.php index b3a89ff7..69f6d64e 100644 --- a/www/lib/Error.Handling.php +++ b/www/lib/Error.Handling.php @@ -25,8 +25,13 @@ declare(strict_types=1); * @return bool True, so cought errors do not get processed * by the PHP error engine */ -function MyErrorHandler(int $type, string $message, string $file, int $line, array $context): bool -{ +function MyErrorHandler( + int $type, + string $message, + string $file, + int $line, + array $context = [] +): bool { if (!(error_reporting() & $type) && SHOW_ALL_ERRORS == false) { // This error code is not included in error_reporting return false;