diff --git a/composer.json b/composer.json index 9ad5e39ad2ca5..de1e7cf9fbd9f 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "symfony/polyfill-intl-icu": "~1.0", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php56": "~1.0", - "symfony/polyfill-php70": "~1.6" + "symfony/polyfill-php70": "~1.6", + "symfony/polyfill-php80": "~1.17" }, "replace": { "symfony/asset": "self.version", diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 1cc72cc132d4a..1f8f993324166 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -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); } diff --git a/src/Symfony/Component/DomCrawler/composer.json b/src/Symfony/Component/DomCrawler/composer.json index ed50e6ee6b4f1..a31b2906946fa 100644 --- a/src/Symfony/Component/DomCrawler/composer.json +++ b/src/Symfony/Component/DomCrawler/composer.json @@ -18,7 +18,8 @@ "require": { "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0" + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.17" }, "require-dev": { "symfony/css-selector": "~2.8|~3.0|~4.0"