From: stronk7 Date: Mon, 29 Sep 2008 17:14:05 +0000 (+0000) Subject: Improve DOM detection (due to conficts with old DOM-XML). MDL-15637 ; merged from... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d47112455bb5a36cc2f5c79579b0ad955fdd4c85;p=moodle.git Improve DOM detection (due to conficts with old DOM-XML). MDL-15637 ; merged from 19_STABLE --- diff --git a/lib/xmldb/xmldb_file.php b/lib/xmldb/xmldb_file.php index efda14f965..85fc25dffd 100644 --- a/lib/xmldb/xmldb_file.php +++ b/lib/xmldb/xmldb_file.php @@ -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); }