Skip to content

Commit

Permalink
[DomCrawler] Catch expected ValueError.
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed May 22, 2020
1 parent ceacdab commit c3086a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,11 @@ public function addHtmlContent($content, $charset = 'UTF-8')
// 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);
}
Expand Down

0 comments on commit c3086a5

Please sign in to comment.