Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
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>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
