From 612302876511bb1f94c194ea9e061d24cfc38e63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Thu, 20 Jan 2011 10:30:32 +0000
Subject: [PATCH] Fix parsing of entity attributes

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2721 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SAML2/XML/saml/AttributeValue.php  | 7 +++++++
 lib/SimpleSAML/Metadata/SAMLParser.php | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/SAML2/XML/saml/AttributeValue.php b/lib/SAML2/XML/saml/AttributeValue.php
index 5351e999a..bc8905592 100644
--- a/lib/SAML2/XML/saml/AttributeValue.php
+++ b/lib/SAML2/XML/saml/AttributeValue.php
@@ -68,6 +68,13 @@ class SAML2_XML_saml_AttributeValue {
 		return $v;
 	}
 
+	/*
+	 * Returns a plain text content of the attribute value.
+	 */
+	public function getString() {
+		return $this->element->textContent;
+	}
+
 
 	/**
 	 * Convert this attribute value to a string.
diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php
index e27baf138..e81732999 100644
--- a/lib/SimpleSAML/Metadata/SAMLParser.php
+++ b/lib/SimpleSAML/Metadata/SAMLParser.php
@@ -904,7 +904,9 @@ class SimpleSAML_Metadata_SAMLParser {
 							}
 							
 							$values = array();
-							foreach($attr->AttributeValue AS $attrvalue) $values[] = (string) $attrvalue;
+							foreach($attr->AttributeValue AS $attrvalue) {
+								$values[] = $attrvalue->getString();
+							}
 
 							$ret['EntityAttributes'][$name] = $values;
 						}
-- 
GitLab