First phpstan strict check

This commit is contained in:
Clemens Schwaighofer
2023-02-28 06:54:20 +09:00
parent 537bc0a477
commit da0d939068
6 changed files with 14 additions and 14 deletions

View File

@@ -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(),

View File

@@ -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;
}

View File

@@ -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';
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -341,6 +341,7 @@ class Session
if (isset($_SESSION[$name])) {
return $_SESSION[$name];
}
return [];
}
/**