Skip Menu | You are currently an anonymous guest. | Login | Return to Main | About rt.cpan.org
 

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

X Report information
Id: 16749
Status: resolved
Left: 0 min
Priority: 0/0
Queue: HTML-Parser

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

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



X History Display mode: Brief headersFull headers
#   Tue Dec 27 12:05:27 2005 guest - Ticket created  
Subject: marked_sections with text ending in square bracket parses wrong
[text/plain 536b]
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.

#   Tue Dec 27 12:30:29 2005 guest - Correspondence added  
From: paul.bijnens[...]xplanation.com
[text/plain 533b]
[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.

#   Wed Feb 08 05:49:12 2006 GAAS - Status changed from 'new' to 'resolved'