Skip to content

Commit

Permalink
PHP 8.1 deprecation messages when the user has no mail or uid (#5079)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiu-cristea committed Feb 21, 2022
1 parent d3deb23 commit 23d5e0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Drupal/Commands/core/UserCommands.php
Expand Up @@ -354,7 +354,7 @@ public function infoArray($account): array
protected function getAccounts(string $names = '', array $options = []): array
{
$accounts = [];
if ($mails = StringUtils::csvToArray($options['mail'])) {
if (isset($options['mail']) && $mails = StringUtils::csvToArray($options['mail'])) {
foreach ($mails as $mail) {
if ($account = user_load_by_mail($mail)) {
$accounts[$account->id()] = $account;
Expand All @@ -363,7 +363,7 @@ protected function getAccounts(string $names = '', array $options = []): array
}
}
}
if ($uids = StringUtils::csvToArray($options['uid'])) {
if (isset($options['uid']) && $uids = StringUtils::csvToArray($options['uid'])) {
foreach ($uids as $uid) {
if ($account = User::load($uid)) {
$accounts[$account->id()] = $account;
Expand Down

0 comments on commit 23d5e0f

Please sign in to comment.