From f4675749243e790538ebf76d6fbb54a2cf715d70 Mon Sep 17 00:00:00 2001
From: Guy Halse <guy@tenet.ac.za>
Date: Thu, 1 Feb 2018 12:17:14 +0200
Subject: [PATCH] Casting as a (string) doesn't flatten an array

---
 modules/saml/lib/IdP/SAML2.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/saml/lib/IdP/SAML2.php b/modules/saml/lib/IdP/SAML2.php
index 36035583c..350f9b5c6 100644
--- a/modules/saml/lib/IdP/SAML2.php
+++ b/modules/saml/lib/IdP/SAML2.php
@@ -986,9 +986,9 @@ class SAML2
 
         if ($nameIdFormat === null || !isset($state['saml:NameID'][$nameIdFormat])) {
             // either not set in request, or not set to a format we supply. Fall back to old generation method
-            $nameIdFormat = (string)$spMetadata->getArrayizeString('NameIDFormat', null);
+            $nameIdFormat = array_values($spMetadata->getArrayizeString('NameIDFormat', null))[0];
             if ($nameIdFormat === null) {
-                $nameIdFormat = (string)$idpMetadata->getArrayizeString('NameIDFormat', \SAML2\Constants::NAMEID_TRANSIENT);
+                $nameIdFormat = array_values($idpMetadata->getArrayizeString('NameIDFormat', \SAML2\Constants::NAMEID_TRANSIENT))[0];
             }
         }
 
-- 
GitLab