php-src
php-src copied to clipboard
Replace Libxml2 by Gumbo or Lexbor for HTML parsing
Description
DOMDocument->loadHTML uses Libxml2 and is fundamentally broken. Valid HTML documents exist that cannot be parsed correctly and there are no simple workarounds that work in all cases. Specifically:
- Closing HTML tag inside script contents, which is not a rare occurrence, break the parser. Fixing this for all possible cases by pre-processing is not possible without complete tokenization of the document, because strings like "
Owner
Other Repo Issues