]> git.mjollnir.org Git - moodle.git/commitdiff
Improve DOM detection (due to conficts with old DOM-XML). MDL-15637 ; merged from...
authorstronk7 <stronk7>
Mon, 29 Sep 2008 17:14:05 +0000 (17:14 +0000)
committerstronk7 <stronk7>
Mon, 29 Sep 2008 17:14:05 +0000 (17:14 +0000)
lib/xmldb/xmldb_file.php

index efda14f9650abf116e5f28c35fa353f66a694af4..85fc25dffd5afdd3bae8a24525ca6989c3c0770e 100644 (file)
@@ -74,11 +74,11 @@ class xmldb_file extends xmldb_object {
     function validateXMLStructure() {
 
     /// Going to perform complete DOM schema validation
-        if (extension_loaded('dom')) {
+        if (extension_loaded('dom') && method_exists(new DOMDocument(), 'load')) {
         /// Let's capture errors
-        if (function_exists('libxml_use_internal_errors')) {
-            libxml_use_internal_errors(true); // This function is PHP5 only (MDL-8730)
-        }
+            if (function_exists('libxml_use_internal_errors')) {
+                libxml_use_internal_errors(true); // This function is PHP5 only (MDL-8730)
+            }
 
         /// Create and load XML file
             $parser = new DOMDocument();
@@ -100,7 +100,7 @@ class xmldb_file extends xmldb_object {
             /// Add errors to structure
                 $structure->errormsg = 'XML Error: ';
                 foreach ($errors as $error) {
-                    $structure->errormsg .= sprintf("%s at line %d. ", 
+                    $structure->errormsg .= sprintf("%s at line %d. ",
                                                      trim($error->message, "\n\r\t ."),
                                                      $error->line);
                 }