0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

Fix broken trusted comments functionality.

This fix is slightly hackish, as we simply treat comments as whitespace.
This should largely be correct, and breaks no current test cases,
although it could result in noncompliant behavior.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang 2009-02-05 18:04:10 -05:00
parent b9094d5ec8
commit 07ed1bbf8c
5 changed files with 15 additions and 1 deletions

View File

@ -110,7 +110,7 @@ class HTMLPurifier_ChildDef_Table extends HTMLPurifier_ChildDef
$collection[] = $token;
continue;
default:
if ($token instanceof HTMLPurifier_Token_Text && $token->is_whitespace) {
if (!empty($token->is_whitespace)) {
$collection[] = $token;
$tag_index++;
}

View File

@ -6,6 +6,7 @@
class HTMLPurifier_Token_Comment extends HTMLPurifier_Token
{
public $data; /**< Character data within comment. */
public $is_whitespace = true;
/**
* Transparent constructor.
*

View File

@ -0,0 +1,5 @@
--INI--
HTML.Trusted = true
--HTML--
<ul><!-- Foo --></ul>
--EXPECT--

View File

@ -0,0 +1,4 @@
--INI--
HTML.Trusted = true
--HTML--
<table><!-- foo --><tr><td>Foo</td></tr></table>

View File

@ -0,0 +1,4 @@
--INI--
HTML.Trusted = true
--HTML--
<!-- Foobar -->