[DomCrawler] Catch expected ValueError.

This commit is contained in:
Alexander M. Turek 2020-05-22 18:49:08 +02:00
parent e220e7cc01
commit b1db13728b

View File

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