From e866743d77340beaeabc7adaf2c0e547071ad2f7 Mon Sep 17 00:00:00 2001
From: Jaime Perez <jaime.perez@uninett.no>
Date: Fri, 18 Jul 2014 16:46:56 +0200
Subject: [PATCH] Revert "Fail gracefully while parsing EntitiesDescriptor in
 the metarefresh module. Now only the offending entity is disregarded. Fixes
 #70."

This reverts commit 6a61491389174b8797014428e2d92124cf61e8c4.
---
 modules/metarefresh/lib/MetaLoader.php | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php
index 2d99ea73f..f34b58f0c 100644
--- a/modules/metarefresh/lib/MetaLoader.php
+++ b/modules/metarefresh/lib/MetaLoader.php
@@ -216,31 +216,7 @@ class sspmod_metarefresh_MetaLoader {
 			throw new Exception('Failed to read XML from ' . $source['src']);
 		}
 		if($doc->documentElement ===  NULL) throw new Exception('Opened file is not an XML document: ' . $source['src']);
-
-		if (SimpleSAML_Utilities::isDOMElementOfType($doc->documentElement, 'EntitiesDescriptor', '@md') === TRUE) {
-			foreach (SAML2_Utils::xpQuery($doc->documentElement,
-				'./saml_metadata:EntityDescriptor|./saml_metadata:EntitiesDescriptor') as $node) {
-
-				if ($node->localName === 'EntityDescriptor') {
-					try {
-						$entities = array_merge($entities,
-							SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement($node));
-					} catch (Exception $e) {
-						$entityID = $node->getAttribute('entityID');
-						if (empty($entityID)) {
-							$entityID = "unknown";
-						}
-						SimpleSAML_Logger::warning('[metarefresh]: Error while parsing entity ('.$entityID.'): '.
-							$e->getMessage());
-					}
-				} else {
-					$entities = array_merge($entities, $this->loadXML($node->ownerDocument->saveXML($node), $source));
-				}
-			}
-		} else {
-			$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement($doc->documentElement);
-		}
-
+		$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement($doc->documentElement);
 		return $entities;
 	}
 
-- 
GitLab