From d92a64b8f35bbbf5cb21d434f8966eac708840bf Mon Sep 17 00:00:00 2001 From: Fredrik Sundblom Date: Thu, 22 Apr 2021 16:57:44 +0200 Subject: [PATCH] Wrapped loadXML method within a try-catch and return false instead of throwing an error. --- src/Saml2/Utils.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Saml2/Utils.php b/src/Saml2/Utils.php index 582c117b..ce78324c 100644 --- a/src/Saml2/Utils.php +++ b/src/Saml2/Utils.php @@ -87,7 +87,11 @@ public static function loadXML(DOMDocument $dom, $xml) $oldEntityLoader = libxml_disable_entity_loader(true); } - $res = $dom->loadXML($xml); + try { + $res = $dom->loadXML($xml); + } catch (\Exception $e) { + return false; + } if (PHP_VERSION_ID < 80000) { libxml_disable_entity_loader($oldEntityLoader);