diff --git a/NEWS b/NEWS index 8d89d0da..990b9450 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Autoclose now operates iteratively, i.e.
now has both span tags closed. - Fix bug with trusted script handling in libxml versions later than 2.6.28. +- Fix bug in comment parsing with DirectLex 2.1.3, released 2007-11-05 ! tests/multitest.php allows you to test multiple versions by running diff --git a/library/HTMLPurifier/Lexer/DirectLex.php b/library/HTMLPurifier/Lexer/DirectLex.php index 86c0a211..e7f39361 100644 --- a/library/HTMLPurifier/Lexer/DirectLex.php +++ b/library/HTMLPurifier/Lexer/DirectLex.php @@ -168,7 +168,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer // Check if it's a comment if ( - substr($segment, 0, 3) === '!--' + strncmp('!--', $segment, 3) === 0 ) { // re-determine segment length, looking for --> $position_comment_end = strpos($html, '-->', $cursor); @@ -185,11 +185,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer $strlen_segment = $position_comment_end - $cursor; $segment = substr($html, $cursor, $strlen_segment); $token = new - HTMLPurifier_Token_Comment( - substr( - $segment, 3, $strlen_segment - 3 - ) - ); + HTMLPurifier_Token_Comment($segment, 3); if ($maintain_line_numbers) { $token->line = $current_line; $current_line += $this->substrCount($html, $nl, $cursor, $strlen_segment);