Closed
Description
Symfony version(s) affected:
symfony/dom-crawler 5.2.10
Description
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
Parsing an HTML document with Crawler and meta http-equiv mentioned above, then retrieving the result, and all nodes are empty although *Symfony\Component\DomCrawler\Crawler*html5Parser
has errors - Line 0, Col 0: Unexpected text. Ignoring...
no chance to get this error, crawler doesn't allow us to get error
How to reproduce
use Symfony\Component\DomCrawler\Crawler;
$html = <<<'HTML'
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 14">
<meta name="Originator" content="Microsoft Word 14">
</head>
<body>
<p class="message">Hello World!</p>
<p>Hello Crawler!</p>
</body>
</html>
HTML;
$crawler = new Crawler($html);
$htmlResult = $crawler->outerHtml();
Possible Solution
add getter to $html5Parser
or make it protected