Skip to content

Commit 5d7b7e9

Browse files
bug #36915 [DomCrawler] Catch expected ValueError (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- [DomCrawler] Catch expected ValueError | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #36872 | License | MIT | Doc PR | N/A This is #36906 ported to the 4.4 branch. Commits ------- 32691e5 [DomCrawler] Catch expected ValueError.
2 parents a25e88b + 32691e5 commit 5d7b7e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1204,11 +1204,11 @@ private function convertToHtmlEntities(string $htmlContent, string $charset = 'U
12041204

12051205
try {
12061206
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
1207-
} catch (\Exception $e) {
1207+
} catch (\Exception | \ValueError $e) {
12081208
try {
12091209
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
12101210
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
1211-
} catch (\Exception $e) {
1211+
} catch (\Exception | \ValueError $e) {
12121212
}
12131213

12141214
return $htmlContent;

0 commit comments

Comments
 (0)