diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php
index a0081d7588efaad777df38eeab600d5e8bb767fb..4b6c3cdfbd6b90972359418c3f674e9774564eb2 100644
--- a/lib/SimpleSAML/Utils/XML.php
+++ b/lib/SimpleSAML/Utils/XML.php
@@ -449,16 +449,7 @@ class XML
             $schemaPath = $config->resolvePath('schemas');
             $schemaFile = $schemaPath . '/' . $schema;
 
-            $entityLoader = libxml_disable_entity_loader(true);
-            $internalErrors = libxml_use_internal_errors(true);
-            libxml_clear_errors();
-
             $res = $dom->schemaValidate($schemaFile);
-
-            libxml_use_internal_errors($internalErrors);
-            libxml_disable_entity_loader($entityLoader);
-            libxml_clear_errors();
-
             if ($res) {
                 Errors::end();
                 return true;