Skip Menu |

This queue is for tickets about the XML-RSS CPAN distribution.

Report information
The Basics
Id: 50787
Status: rejected
Priority: 0/
Queue: XML-RSS

People
Owner: Nobody in particular
Requestors: matt [...] pair.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: <guid> element outside of <item> causes fatal error
Date: Fri, 23 Oct 2009 16:31:23 -0400 (EDT)
To: bug-XML-RSS [...] rt.cpan.org
From: Matt Riffle <matt [...] pair.com>
XML::RSS Version: 1.46 A <guid> element that is outside of an <item> element (which is invalid RSS, admittedly) causes this fatal error: Modification of non-creatable array value attempted, subscript -1 at /usr/local/lib/perl5/site_perl/5.8.9/XML/RSS.pm line 914, <DATA> line 42. That's a call to _last_item, which seems to happen at line 1019: elsif ($el eq 'guid') { $self->_last_item->{'isPermaLink'} = (exists($attribs{'isPermaLink'}) && (lc($attribs{'isPermaLink'}) eq 'true') ); Below is a patch that seems to solve the issue, though I confess I'm not familiar enough with the overall codebase to know if it has other side-effects. It also assumes you want to accept the input, rather than, say, throwing a more informative error. Thanks, Matt Riffle pair Networks, Inc. -- 914c914,916 < return ($self->{'items'}->[$self->{num_items} - 1] ||= {}); --- Show quoted text
> #return ($self->{'items'}->[$self->{num_items} - 1] ||= {}); > return (ref($self->{'items'}) eq 'ARRAY') ? > $self->{'items'}->[$self->{num_items} - 1] : {};
1020c1022 < $self->_last_item->{'isPermaLink'} = --- Show quoted text
> $self->_last_item and $self->_last_item->{'isPermaLink'} =
RT-Send-CC: matt [...] pair.com
Hi Mr. Riffle! Thanks for your report, and sorry for the late response. On Fri Oct 23 16:31:47 2009, matt@pair.com wrote: Show quoted text
> > XML::RSS Version: 1.46 > > A <guid> element that is outside of an <item> element (which is invalid > RSS, admittedly) causes this fatal error: > > Modification of non-creatable array value attempted, subscript -1 at > /usr/local/lib/perl5/site_perl/5.8.9/XML/RSS.pm line 914, <DATA> line 42. > > That's a call to _last_item, which seems to happen at line 1019: > > elsif ($el eq 'guid') { > $self->_last_item->{'isPermaLink'} = > (exists($attribs{'isPermaLink'}) && > (lc($attribs{'isPermaLink'}) eq 'true') > ); > > Below is a patch that seems to solve the issue, though I confess I'm not > familiar enough with the overall codebase to know if it has other > side-effects. It also assumes you want to accept the input, rather than, > say, throwing a more informative error. > > Thanks, > > Matt Riffle > pair Networks, Inc. >
This patch should be generated by "svn diff" based on: http://svn.perl.org/modules/XML-RSS/trunk If you can provide an offending (and invalid) RSS file, then I can take it from there. Furthermore, it should include a test case - see the files under t/*.t. Regards, -- Shlomi Fish Show quoted text
> -- > > 914c914,916 > < return ($self->{'items'}->[$self->{num_items} - 1] ||= {}); > ---
> > #return ($self->{'items'}->[$self->{num_items} - 1] ||= {}); > > return (ref($self->{'items'}) eq 'ARRAY') ? > > $self->{'items'}->[$self->{num_items} - 1] : {};
> 1020c1022 > < $self->_last_item->{'isPermaLink'} = > ---
> > $self->_last_item and $self->_last_item->{'isPermaLink'} =
>
Resolving as "OLD" due to the lack of responsiveness from the original poster.