From 00c66fa9cb56825617f8f492e6c4492977aa4b08 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 31 May 2010 19:44:18 -0700 Subject: [PATCH] Fix bug in parsing single attribute with entities. Signed-off-by: Edward Z. Yang --- NEWS | 2 ++ configdoc/usage.xml | 1 + library/HTMLPurifier/Lexer/DirectLex.php | 2 +- tests/HTMLPurifier/LexerTest.php | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1e06a8fb..1cad3a36 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ========================== 4.1.1, unknown release date +- Fix bug in DirectLex for parsing elements with a single attribute + with entities. - Rewrite CSS output logic for font-family and url(). Thanks Mario Heiderich for reporting and Takeshi Terada for suggesting the fix. diff --git a/configdoc/usage.xml b/configdoc/usage.xml index e0c48384..ec5b4166 100644 --- a/configdoc/usage.xml +++ b/configdoc/usage.xml @@ -6,6 +6,7 @@ 81 + 269 53 diff --git a/library/HTMLPurifier/Lexer/DirectLex.php b/library/HTMLPurifier/Lexer/DirectLex.php index 439409d0..456e6e19 100644 --- a/library/HTMLPurifier/Lexer/DirectLex.php +++ b/library/HTMLPurifier/Lexer/DirectLex.php @@ -384,7 +384,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer } } if ($value === false) $value = ''; - return array($key => $value); + return array($key => $this->parseData($value)); } // setup loop environment diff --git a/tests/HTMLPurifier/LexerTest.php b/tests/HTMLPurifier/LexerTest.php index 1e5c0409..8652c404 100644 --- a/tests/HTMLPurifier/LexerTest.php +++ b/tests/HTMLPurifier/LexerTest.php @@ -262,6 +262,15 @@ class HTMLPurifier_LexerTest extends HTMLPurifier_Harness ); } + function test_tokenizeHTML_singleAttribute() { + $this->assertTokenization( + '
', + array( + new HTMLPurifier_Token_Empty('br', array('style' => '&')) + ) + ); + } + function test_tokenizeHTML_emptyTag() { $this->assertTokenization( '
', -- 2.11.4.GIT