Disable XML error warnings when parsing unclean inputs from Wikidata

This commit is contained in:
Joshua Ramon Enslin 2025-02-13 21:48:07 +01:00
parent 2f3bc5f2fa
commit 28f6db67ff
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -281,7 +281,9 @@ final class NodaWikidataFetcher {
$doc = new DOMDocument();
try {
libxml_use_internal_errors(true);
$doc->loadXML('<section>' . trim($input) . '</section>');
libxml_use_internal_errors(false);
}
catch (Exception $e) {
throw new Exception("Failed to load DOMDocument." . PHP_EOL . $e->getMessage() . PHP_EOL . PHP_EOL . '---' . $input . '---');