[DomCrawler] Catch expected ValueError.

This commit is contained in:
Alexander M. Turek 2020-05-22 18:49:08 +02:00
parent e220e7cc01
commit b1db13728b
1 changed files with 3 additions and 2 deletions

View File

@ -193,10 +193,11 @@ class Crawler implements \Countable, \IteratorAggregate
// Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML()
$content = mb_convert_encoding($content, 'HTML-ENTITIES', $charset);
} catch (\Exception $e) {
} catch (\ValueError $e) {
} finally {
restore_error_handler();
}
restore_error_handler();
if ('' !== trim($content)) {
@$dom->loadHTML($content);
}