From 6ce06ac33ad51ea054191532f7b999dcb4916422 Mon Sep 17 00:00:00 2001 From: Matt H Date: Mon, 19 Aug 2024 14:57:12 -0400 Subject: [PATCH] Avoid adding empty string to `members` when `groups_external` is empty 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. --- application/common/models/User.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/common/models/User.php b/application/common/models/User.php index 835e5bd8..27e63ea8 100644 --- a/application/common/models/User.php +++ b/application/common/models/User.php @@ -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'];