This queue is for tickets about the HTML-Parser CPAN distribution.

Report information
The Basics
Id:
16749
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
paul.bijnens [...] xplanation.com
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
3.48
Fixed in:
(no value)



Subject: marked_sections with text ending in square bracket parses wrong
When processing a document with "marked_sections => 1", and the text ends in a square bracket, the chunk is parsed wrong: ====== cut here ====== #!/usr/bin/perl -w use strict; my $text; use HTML::Parser (); my $p = HTML::Parser->new(text_h => [sub { $text .= shift }, "dtext"], marked_sections => 1, ); use Test::More tests => 1; $p->parse("<![CDATA[foo [1]]]>"); is($text, "foo [1]", "CDATA text ending in square bracket"); ====== cut here ====== Above tested in version 3.48.
From: paul.bijnens@xplanation.com
[guest - Tue Dec 27 12:05:27 2005]: Proposed patch: ====== cut here ====== --- hparser.c_OLD 2005-12-27 18:15:29.000000000 +0100 +++ hparser.c 2005-12-27 18:16:05.000000000 +0100 @@ -1608,9 +1608,8 @@ char *end_text = s; s++; if (*s == ']') { - s++; - if (*s == '>') { - s++; + if (*(s+1) == '>') { + s+=2; /* marked section end */ if (t != end_text) report_event(p_state, E_TEXT, t, end_text, utf8, ====== cut here ====== I'm not sure if we actually shouldn't test for s+1<end too.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.