diff --git a/modules/saml/www/sp/metadata.php b/modules/saml/www/sp/metadata.php
index 713dff616c90352cff9496a16c34d812286c0c49..ab2001e25fb9c2ce4c5c248b7648c82642bff9fc 100644
--- a/modules/saml/www/sp/metadata.php
+++ b/modules/saml/www/sp/metadata.php
@@ -124,7 +124,7 @@ if ($format !== NULL) {
 }
 
 $name = $spconfig->getLocalizedString('name', NULL);
-$attributes = $spconfig->getArray('attributes', array());
+$attributes = array_values($spconfig->getArray('attributes', array()));
 
 if ($name !== NULL && !empty($attributes)) {
 	$metaArray20['name'] = $name;