When making changes to a user, the site breaks caused by expired collector;
Warning: Undefined variable $clients in Drupal\simple_oauth\ExpiredCollector->collectForAccount() (line 99 of /web/modules/contrib/simple_oauth/src/ExpiredCollector.php)
TypeError: array_reduce(): Argument #1 ($array) must be of type array, null given in array_reduce() (line 99 of /web/modules/contrib/simple_oauth/src/ExpiredCollector.php)
Did have the same error on v5 as well.
I don't see the `$clients` variable being defined or assigned anywhere in that function;
public function collectForAccount(AccountInterface $account): array {
$query = $this->tokenStorage->getQuery();
$query->accessCheck();
$query->condition('auth_user_id', $account->id());
$query->condition('bundle', 'refresh_token', '!=');
$entity_ids = $query->execute();
$output = $entity_ids
? array_values($this->tokenStorage->loadMultiple(array_values($entity_ids)))
: [];
// Also collect the tokens of the clients that have this account as the
// default user.
// Append all the tokens for each of the clients having this account as the
// default.
$tokens = array_reduce($clients, function ($carry, $client) {
return array_merge($carry, $this->collectForClient($client));
}, $output);
// Return a unique list.
$existing = [];
foreach ($tokens as $token) {
$existing[$token->id()] = $token;
}
return array_values($existing);
}