From 491876615481def0a870eefc265aafb2c73a90d9 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tim.dijen@minbzk.nl>
Date: Fri, 27 Aug 2021 16:34:48 +0200
Subject: [PATCH] Minor optimization

---
 modules/saml/lib/Auth/Process/FilterScopes.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/saml/lib/Auth/Process/FilterScopes.php b/modules/saml/lib/Auth/Process/FilterScopes.php
index f6c0a8f92..aea28ae3e 100644
--- a/modules/saml/lib/Auth/Process/FilterScopes.php
+++ b/modules/saml/lib/Auth/Process/FilterScopes.php
@@ -66,12 +66,12 @@ class FilterScopes extends ProcessingFilter
             $values = $request['Attributes'][$attribute];
             $newValues = [];
             foreach ($values as $value) {
-                $value_a = explode('@', $value, 2);
-                if (count($value_a) < 2) {
+                list(, $scope) = explode('@', $value, 2);
+                if ($scope === null) {
                     $newValues[] = $value;
                     continue; // there's no scope
                 }
-                $scope = $value_a[1];
+
                 if (in_array($scope, $validScopes, true)) {
                     $newValues[] = $value;
                 } elseif (strpos($host, $scope) === strlen($host) - strlen($scope)) {
-- 
GitLab