mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-01 11:50:28 +02:00
[2.1.4] [MFH] Fix bug in comment parsing with DirectLex from r1570
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/php4@1715 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
1
NEWS
1
NEWS
@@ -17,6 +17,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier
|
|||||||
- Autoclose now operates iteratively, i.e. <span><span><div> now has
|
- Autoclose now operates iteratively, i.e. <span><span><div> now has
|
||||||
both span tags closed.
|
both span tags closed.
|
||||||
- Fix bug with trusted script handling in libxml versions later than 2.6.28.
|
- 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
|
2.1.3, released 2007-11-05
|
||||||
! tests/multitest.php allows you to test multiple versions by running
|
! tests/multitest.php allows you to test multiple versions by running
|
||||||
|
@@ -168,7 +168,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
|
|||||||
|
|
||||||
// Check if it's a comment
|
// Check if it's a comment
|
||||||
if (
|
if (
|
||||||
substr($segment, 0, 3) === '!--'
|
strncmp('!--', $segment, 3) === 0
|
||||||
) {
|
) {
|
||||||
// re-determine segment length, looking for -->
|
// re-determine segment length, looking for -->
|
||||||
$position_comment_end = strpos($html, '-->', $cursor);
|
$position_comment_end = strpos($html, '-->', $cursor);
|
||||||
@@ -185,11 +185,7 @@ class HTMLPurifier_Lexer_DirectLex extends HTMLPurifier_Lexer
|
|||||||
$strlen_segment = $position_comment_end - $cursor;
|
$strlen_segment = $position_comment_end - $cursor;
|
||||||
$segment = substr($html, $cursor, $strlen_segment);
|
$segment = substr($html, $cursor, $strlen_segment);
|
||||||
$token = new
|
$token = new
|
||||||
HTMLPurifier_Token_Comment(
|
HTMLPurifier_Token_Comment($segment, 3);
|
||||||
substr(
|
|
||||||
$segment, 3, $strlen_segment - 3
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if ($maintain_line_numbers) {
|
if ($maintain_line_numbers) {
|
||||||
$token->line = $current_line;
|
$token->line = $current_line;
|
||||||
$current_line += $this->substrCount($html, $nl, $cursor, $strlen_segment);
|
$current_line += $this->substrCount($html, $nl, $cursor, $strlen_segment);
|
||||||
|
Reference in New Issue
Block a user