mirror of https://github.com/FreshRSS/FreshRSS.git
fix: Fix check of existing usernames in cli scripts (#5667)
`preg_grep` returns an empty array if the username matches no elements
from the usernames array.
Regression introduced in 7f9594b8c7
Reference: https://github.com/FreshRSS/FreshRSS/pull/5501
This commit is contained in:
parent
2cb4f2e233
commit
662c9fcc2f
|
@ -10,7 +10,7 @@ if (!FreshRSS_user_Controller::checkUsername($username)) {
|
|||
}
|
||||
|
||||
$usernames = listUsers();
|
||||
if (preg_grep("/^$username$/i", $usernames) !== false) {
|
||||
if (preg_grep("/^$username$/i", $usernames)) {
|
||||
fail('FreshRSS warning: username already exists “' . $username . '”', EXIT_CODE_ALREADY_EXISTS);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ if (!FreshRSS_user_Controller::checkUsername($username)) {
|
|||
}
|
||||
|
||||
$usernames = listUsers();
|
||||
if (preg_grep("/^$username$/i", $usernames) === false) {
|
||||
if (!preg_grep("/^$username$/i", $usernames)) {
|
||||
fail('FreshRSS error: username not found “' . $username . '”');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue