1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-06 14:16:32 +02:00

Supported hundreds of nested HTML (#202)

* Supported hundreds of nested HTML (#201)

* Add Core.AllowParseManyTags
This commit is contained in:
msuzuki
2019-07-15 02:15:31 +09:00
committed by Edward Z. Yang
parent 524cd08a59
commit 8c153eef3a
8 changed files with 42 additions and 2 deletions

View File

@@ -68,8 +68,13 @@ class HTMLPurifier_Lexer_DOMLex extends HTMLPurifier_Lexer
$doc = new DOMDocument();
$doc->encoding = 'UTF-8'; // theoretically, the above has this covered
$options = 0;
if ($config->get('Core.AllowParseManyTags') && defined('LIBXML_PARSEHUGE')) {
$options |= LIBXML_PARSEHUGE;
}
set_error_handler(array($this, 'muteErrorHandler'));
$doc->loadHTML($html);
$doc->loadHTML($html, $options);
restore_error_handler();
$body = $doc->getElementsByTagName('html')->item(0)-> // <html>