Skip to content

Commit c3086a5

Browse files
committed
[DomCrawler] Catch expected ValueError.
1 parent ceacdab commit c3086a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Crawler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,11 @@ public function addHtmlContent($content, $charset = 'UTF-8')
193193
// Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML()
194194
$content = mb_convert_encoding($content, 'HTML-ENTITIES', $charset);
195195
} catch (\Exception $e) {
196+
} catch (\ValueError $e) {
197+
} finally {
198+
restore_error_handler();
196199
}
197200

198-
restore_error_handler();
199-
200201
if ('' !== trim($content)) {
201202
@$dom->loadHTML($content);
202203
}

0 commit comments

Comments
 (0)