[DomCrawler] Catch expected ValueError.
This commit is contained in:
parent
e220e7cc01
commit
b1db13728b
@ -193,9 +193,10 @@ 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);
|
||||||
|
Reference in New Issue
Block a user