diff --git a/src/Plugin/migrate_plus/data_parser/SimpleXml.php b/src/Plugin/migrate_plus/data_parser/SimpleXml.php index a526ecc2346155495472105b221df31769427629..2e51c9a0f3e34cb9013d251527ea692835ee50b4 100644 --- a/src/Plugin/migrate_plus/data_parser/SimpleXml.php +++ b/src/Plugin/migrate_plus/data_parser/SimpleXml.php @@ -38,6 +38,12 @@ class SimpleXml extends DataParserPluginBase { * {@inheritdoc} */ protected function openSourceUrl($url) { + // Clear XML error buffer. Other Drupal code that executed during the + // migration may have polluted the error buffer and could create false + // positives in our error check below. We are only concerned with errors + // that occur from attempting to load the XML string into an object here. + libxml_clear_errors(); + $xml_data = $this->getDataFetcherPlugin()->getResponseContent($url); $xml = simplexml_load_string($xml_data); $this->registerNamespaces($xml); diff --git a/src/Plugin/migrate_plus/data_parser/Xml.php b/src/Plugin/migrate_plus/data_parser/Xml.php index 0213a0f7bb4df3454ff0d88de44168569a883ae6..6c08069276e886dd3907c0cc22ec3a2e18f2b78b 100644 --- a/src/Plugin/migrate_plus/data_parser/Xml.php +++ b/src/Plugin/migrate_plus/data_parser/Xml.php @@ -174,6 +174,13 @@ class Xml extends DataParserPluginBase { protected function openSourceUrl($url) { // (Re)open the provided URL. $this->reader->close(); + + // Clear XML error buffer. Other Drupal code that executed during the + // migration may have polluted the error buffer and could create false + // positives in our error check below. We are only concerned with errors + // that occur from attempting to load the XML string into an object here. + libxml_clear_errors(); + return $this->reader->open($url, NULL, \LIBXML_NOWARNING); }