Disable XML error warnings when parsing unclean inputs from Wikidata
This commit is contained in:
parent
2f3bc5f2fa
commit
28f6db67ff
@ -281,7 +281,9 @@ final class NodaWikidataFetcher {
|
|||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
try {
|
try {
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
$doc->loadXML('<section>' . trim($input) . '</section>');
|
$doc->loadXML('<section>' . trim($input) . '</section>');
|
||||||
|
libxml_use_internal_errors(false);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
throw new Exception("Failed to load DOMDocument." . PHP_EOL . $e->getMessage() . PHP_EOL . PHP_EOL . '---' . $input . '---');
|
throw new Exception("Failed to load DOMDocument." . PHP_EOL . $e->getMessage() . PHP_EOL . PHP_EOL . '---' . $input . '---');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user