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 e220e7c commit b1db137
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Symfony/Component/DomCrawler/Crawler.php
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 b1db137

Please sign in to comment.