From 501d892130f1135a378538721178ff090dd92c8a Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Mon, 23 Mar 2015 16:02:04 +0100
Subject: [PATCH] Bugfix.

---
 modules/saml/www/sp/metadata.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index 647192a9a..5a747095a 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -211,7 +211,9 @@ unset($metaArray20['metadata-set']);
 unset($metaArray20['entityid']);
 
 // sanitize the attributes array to remove friendly names
-$metaArray20['attributes'] = array_values($metaArray20['attributes']);
+if (isset($metaArray20['attributes']) && is_array($metaArray20['attributes'])) {
+    $metaArray20['attributes'] = array_values($metaArray20['attributes']);
+}
 
 /* Sign the metadata if enabled. */
 $xml = SimpleSAML_Metadata_Signer::sign($xml, $spconfig->toArray(), 'SAML 2 SP');
-- 
GitLab