[DomCrawler] Catch expected ValueError.
This commit is contained in:
parent
6d7c696742
commit
32691e5157
@ -1204,11 +1204,11 @@ class Crawler implements \Countable, \IteratorAggregate
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
|
return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception | \ValueError $e) {
|
||||||
try {
|
try {
|
||||||
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
|
$htmlContent = iconv($charset, 'UTF-8', $htmlContent);
|
||||||
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
|
$htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception | \ValueError $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $htmlContent;
|
return $htmlContent;
|
||||||
|
Reference in New Issue
Block a user