Work-around for a non-flushed xml error buffer
authorAlexander Ebert <ebert@woltlab.com>
Thu, 19 Apr 2018 20:07:54 +0000 (22:07 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 19 Apr 2018 20:07:54 +0000 (22:07 +0200)
wcfsetup/install/files/lib/util/XML.class.php

index 043ea3fe27ff314b520c437800cffdf4bfe4155e..59091f7a407318d708fc71002421abbf2a296bc1 100644 (file)
@@ -58,6 +58,10 @@ class XML {
                        throw new SystemException("Could not read xml document located at '".$this->path."'.");
                }
                
+               // flush the error buffer in case someone used global xml functions
+               // without polling / clearing the buffer after use
+               libxml_clear_errors();
+               
                // load xml document
                $this->document->load($path);
                
@@ -77,6 +81,10 @@ class XML {
        public function loadXML($path, $xml) {
                $this->path = $path;
                
+               // flush the error buffer in case someone used global xml functions
+               // without polling / clearing the buffer after use
+               libxml_clear_errors();
+               
                // load xml document
                $this->document->loadXML($xml);