From 081a93b40ee256b830b3ad59f13a05f09c6ecca0 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tim.dijen@minbzk.nl>
Date: Fri, 6 Mar 2020 09:39:53 +0100
Subject: [PATCH] Fix PossiblyUndefinedVariable|PossiblyNullArgument

---
 lib/SimpleSAML/Utils/XML.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Utils/XML.php b/lib/SimpleSAML/Utils/XML.php
index 750340c8d..3822e5fac 100644
--- a/lib/SimpleSAML/Utils/XML.php
+++ b/lib/SimpleSAML/Utils/XML.php
@@ -262,6 +262,7 @@ class XML
         }
 
         $root = $doc->firstChild;
+        Assert::notNull($root);
         self::formatDOMElement($root, $indentBase);
 
         return $doc->saveXML($root);
@@ -424,7 +425,7 @@ class XML
             }
         }
 
-        if ($res) {
+        if ($res === true) {
             $config = Configuration::getInstance();
             /** @var string $schemaPath */
             $schemaPath = $config->resolvePath('schemas');
@@ -445,6 +446,7 @@ class XML
                 }
             );
 
+            /** @psalm-suppress PossiblyUndefinedVariable */
             $res = $dom->schemaValidate($schemaFile);
             if ($res) {
                 Errors::end();
-- 
GitLab