]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8730: These libxml_* functions are PHP5 only. I've wrapped them in function_exist...
authornicolasconnault <nicolasconnault>
Mon, 26 Mar 2007 03:42:22 +0000 (03:42 +0000)
committernicolasconnault <nicolasconnault>
Mon, 26 Mar 2007 03:42:22 +0000 (03:42 +0000)
lib/xmldb/classes/XMLDBFile.class.php

index 6e5dfdc5db12f2849f5fc34c684f11245b7b3533..a4df766893611719b445858037fe45f9c76a07ef 100644 (file)
@@ -76,7 +76,10 @@ class XMLDBFile extends XMLDBObject {
     /// Going to perform complete DOM schema validation
         if (extension_loaded('dom')) {
         /// Let's capture errors
-            libxml_use_internal_errors(true);
+        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();
             $parser->load($this->path);
@@ -85,7 +88,11 @@ class XMLDBFile extends XMLDBObject {
                 $parser->schemaValidate($this->schema);
             }
         /// Check for errors
-            $errors = libxml_get_errors();
+            $errors = false;
+            if (function_exists('libxml_get_errors')) {
+                $errors = libxml_get_errors();
+            }
+
         /// Prepare errors
             if (!empty($errors)) {
             /// Create one structure to store errors