Skip to content

Commit

Permalink
Avoid adding empty string to members when groups_external is empty
Browse files Browse the repository at this point in the history
PHP's `explode()` returns an array with an empty string if the given
string is empty, but we do not want to add that to the `members` list.
  • Loading branch information
forevermatt committed Aug 19, 2024
1 parent b608e9f commit 6ce06ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion application/common/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ public function fields(): array

$externalGroups = explode(',', $model->groups_external);
foreach ($externalGroups as $externalGroup) {
$member[] = $externalGroup;
if (!empty($externalGroup)) {
$member[] = $externalGroup;
}
}

$member[] = \Yii::$app->params['idpName'];
Expand Down

0 comments on commit 6ce06ac

Please sign in to comment.