[Koha-cvs] CVS: koha/misc/translator TmplTokenizer.pm,1.26,1.27
Ambrose C. LI
acli at users.sourceforge.net
Wed Feb 25 07:25:31 CET 2004
Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4769
Modified Files:
TmplTokenizer.pm
Log Message:
After the previous change, the scanner will hang if the input is malformed
in a certain way, such as having a <title> but not matching </title>.
This should fix it.
Index: TmplTokenizer.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/TmplTokenizer.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** TmplTokenizer.pm 25 Feb 2004 06:08:41 -0000 1.26
--- TmplTokenizer.pm 25 Feb 2004 06:25:29 -0000 1.27
***************
*** 427,433 ****
}
} else {
for ($it = '', my $cdata_close = $this->cdata_close;;) {
my $next = $this->_next_token_internal($h);
! last if !defined $next;
if (defined $next && $next->string =~ /$cdata_close/is) {
$this->_push_readahead( $next ); # push entire TmplToken object
--- 427,435 ----
}
} else {
+ my $eof_p = 0;
for ($it = '', my $cdata_close = $this->cdata_close;;) {
my $next = $this->_next_token_internal($h);
! $eof_p = !defined $next;
! last if $eof_p;
if (defined $next && $next->string =~ /$cdata_close/is) {
$this->_push_readahead( $next ); # push entire TmplToken object
***************
*** 437,440 ****
--- 439,450 ----
$it .= $next->string;
}
+ if ($eof_p) {
+ $it = undef;
+ error_normal "Unexpected end of file while looking for "
+ . $this->cdata_close
+ . "\n", $this->line_number_start;
+ $this->_set_fatal( 1 );
+ $this->_set_syntaxerror( 1 );
+ }
if ($this->pcdata_mode_p) {
my $check = $it;
***************
*** 444,450 ****
if $check =~ /$re_tag_compat/s;
}
! $it = TmplToken->new( $it, TmplTokenType::CDATA, $this->line_number );
$this->_set_pcdata_mode, 0;
! $this->_set_cdata_close, undef;
}
return $it;
--- 454,461 ----
if $check =~ /$re_tag_compat/s;
}
! $it = TmplToken->new( $it, TmplTokenType::CDATA, $this->line_number )
! if defined $it;
$this->_set_pcdata_mode, 0;
! $this->_set_cdata_close, undef unless !defined $it;
}
return $it;
More information about the Koha-cvs
mailing list