From 4c5e89d85d93738deee42bf8d89ab4d71056525e Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tim.dijen@minbzk.nl>
Date: Thu, 29 Aug 2019 23:09:44 +0200
Subject: [PATCH] Fix case where attribute-value is not a string

Integers for example are not uncommon..
This closes #1152
---
 modules/saml/lib/Auth/Process/AttributeNameID.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/saml/lib/Auth/Process/AttributeNameID.php b/modules/saml/lib/Auth/Process/AttributeNameID.php
index 939bcacdb..7c747c0ad 100644
--- a/modules/saml/lib/Auth/Process/AttributeNameID.php
+++ b/modules/saml/lib/Auth/Process/AttributeNameID.php
@@ -54,7 +54,6 @@ class AttributeNameID extends \SimpleSAML\Module\saml\BaseNameIDGenerator
      */
     protected function getValue(array &$state)
     {
-
         if (!isset($state['Attributes'][$this->attribute]) || count($state['Attributes'][$this->attribute]) === 0) {
             Logger::warning(
                 'Missing attribute '.var_export($this->attribute, true).
@@ -70,7 +69,7 @@ class AttributeNameID extends \SimpleSAML\Module\saml\BaseNameIDGenerator
             return null;
         }
         $value = array_values($state['Attributes'][$this->attribute]); // just in case the first index is no longer 0
-        $value = $value[0];
+        $value = strval($value[0]);
 
         if (empty($value)) {
             Logger::warning(
-- 
GitLab