diff options
| author | 2023-07-07 21:53:17 +0200 | |
|---|---|---|
| committer | 2023-07-07 21:53:17 +0200 | |
| commit | 7f9594b8c7d7799f2e5f89328bd5981410db8cf0 (patch) | |
| tree | 67614f8f3d04e94139d19dad3dd438f3bd949368 /cli | |
| parent | 1db606bc1b6cf25d9b9c4bef362acdb964ce1e8a (diff) | |
fix many "Only booleans are allowed in an if condition" (#5501)
* fix many "Only booleans are allowed in an if condition"
* Update cli/create-user.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Update cli/i18n/I18nUsageValidator.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
* Fix several regressions and other minor things
* Fix another regression
* Update lib/http-conditional.php
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
---------
Co-authored-by: Luc <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'cli')
| -rwxr-xr-x | cli/create-user.php | 4 | ||||
| -rwxr-xr-x | cli/delete-user.php | 2 | ||||
| -rw-r--r-- | cli/i18n/I18nUsageValidator.php | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/cli/create-user.php b/cli/create-user.php index 27e27f7a1..1da7f580d 100755 --- a/cli/create-user.php +++ b/cli/create-user.php @@ -10,7 +10,7 @@ if (!FreshRSS_user_Controller::checkUsername($username)) { } $usernames = listUsers(); -if (preg_grep("/^$username$/i", $usernames)) { +if (preg_grep("/^$username$/i", $usernames) !== false) { fail('FreshRSS warning: username already exists “' . $username . '”', EXIT_CODE_ALREADY_EXISTS); } @@ -31,7 +31,7 @@ if (!$ok) { if (!empty($options['api_password'])) { $username = cliInitUser($username); $error = FreshRSS_api_Controller::updatePassword($options['api_password']); - if ($error) { + if ($error !== false) { fail($error); } } diff --git a/cli/delete-user.php b/cli/delete-user.php index fbbb2eebb..7b05cbe7a 100755 --- a/cli/delete-user.php +++ b/cli/delete-user.php @@ -19,7 +19,7 @@ if (!FreshRSS_user_Controller::checkUsername($username)) { } $usernames = listUsers(); -if (!preg_grep("/^$username$/i", $usernames)) { +if (preg_grep("/^$username$/i", $usernames) === false) { fail('FreshRSS error: username not found “' . $username . '”'); } diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php index 0d85077f0..f8e3c6051 100644 --- a/cli/i18n/I18nUsageValidator.php +++ b/cli/i18n/I18nUsageValidator.php @@ -42,7 +42,7 @@ class I18nUsageValidator implements I18nValidatorInterface { foreach ($this->reference as $file => $data) { foreach ($data as $key => $value) { $this->totalEntries++; - if (preg_match('/\._$/', $key) && in_array(preg_replace('/\._$/', '', $key), $this->code, true)) { + if (preg_match('/\._$/', $key) === 1 && in_array(preg_replace('/\._$/', '', $key), $this->code, true)) { continue; } if (!in_array($key, $this->code, true)) { |
