Skip Menu |
 

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

Report information
The Basics
Id: 2534
Status: resolved
Priority: 0/
Queue: XML-RSS

People
Owner: KELLAN [...] cpan.org
Requestors: spam [...] gemal.dk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.02
Fixed in: 1.04



Subject: Use of uninitialized value in exists at /usr/local/share/perl/5.6.1/XML/RSS.pm line 1432.
Download (untitled) / with headers
text/plain 200b
I'm seeing: Use of uninitialized value in exists at /usr/local/share/perl/5.6.1/XML/RSS.pm line 1432. perhaps if ($el eq 'rss') { could be changed into: if ($el && $el eq 'rss') { using 1.02
From: brad [...] digitaldogma.com
Download (untitled) / with headers
text/plain 519b
I am also seeing this bug, but as listing indicates, different perl rev. I am also running 1.02. Anybody looked at this bug yet? Thanks, brad@digitaldogma.com Use of uninitialized value in exists at /usr/lib/perl5/site_perl/5.8.0/XML/RSS.pm line 1432. [guest - Thu May 8 07:08:34 2003]: Show quoted text
> I'm seeing: > Use of uninitialized value in exists at > /usr/local/share/perl/5.6.1/XML/RSS.pm line 1432. > > perhaps > if ($el eq 'rss') { > could be changed into: > if ($el && $el eq 'rss') { > > using 1.02
From: dragle [...] jupitermedia.com
Download (untitled) / with headers
text/plain 1.2k
[guest - Thu May 8 07:08:34 2003]: I've got the same problem, exact same warning message; adding my reply here so hopefully I can be notified if a fix is offered. If it helps, here's some troubleshooting info. We upgraded XML::RSS (0.95->1.02), XML::Parser (2.29->2.30), and Perl (5.005->5.6.1) all at the same time, so I don't know if that helps narrow anything down. The problem only seems to occur with .91 RSS files (not 1.0), and just parsing the file produces the warnings; i.e., use strict; use XML::RSS; my $rss = new XML::RSS; $rss->parsefile("test.rdf"); Is enough to cause the error on a .91 file. The problem seems to be this test, which appears twice in the method: elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) ... when I changed it to: elsif ( $self->namespace($el) and exists( $rdf_resource_fields{ $self->namespace($el) } ) ... the warning went away (though I don't claim to know what other havoc that might reek on your code... :) Cheers! Dan Ragle dragle@jupitermedia.com Show quoted text
> I'm seeing: > Use of uninitialized value in exists at > /usr/local/share/perl/5.6.1/XML/RSS.pm line 1432. > > perhaps > if ($el eq 'rss') { > could be changed into: > if ($el && $el eq 'rss') { > > using 1.02
Whoops, I've just created a duplicate for this bug. Sorry. But I've posted a fix for it too :)
From: jbisbee [...] cpan.org
Download (untitled) / with headers
text/plain 470b
Well this is still open and been bugging me so I hunted down the root of the problem and provided a patch... It looks like XML::Parser::Expat::namespace returns an undef at times and in XML::RSS::handle_start $self->namespace is called but never checked to see if its defined. I've added a patch that simply changes all $ns = $self->namespace(...) calls to $ns = $self->namespace(...) || "" to make sure that the value that is evaluated is a defined.
Download XML-RSS-1.02.patch
text/x-diff 1.8k
Index: RSS.pm =================================================================== RCS file: /var/lib/cvs/cpan/XML-RSS-Feed/lib/XML/RSS.pm,v retrieving revision 1.1 diff -u -r1.1 RSS.pm --- RSS.pm 15 Jan 2004 14:06:30 -0000 1.1 +++ RSS.pm 15 Jan 2004 14:15:11 -0000 @@ -1475,7 +1475,7 @@ # beginning of item element } elsif ($el eq 'item') { # deal with trouble makers who use mod_content :) - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( (!$ns && !$self->{rss_namespace}) || @@ -1503,11 +1503,11 @@ $self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo'; } # beginning of a channel element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{ $self->namespace($el) || ""} ) and + exists( $rdf_resource_fields{ $self->namespace($el) || "" }{ $el } ) and $self->current_element eq 'channel' ) { - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( $ns eq $self->{rss_namespace} ) { $self->{channel}->{$el} = $attribs{resource}; @@ -1523,11 +1523,11 @@ } } # beginning of an item element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{ $self->namespace($el) || "" } ) and + exists( $rdf_resource_fields{ $self->namespace($el) || "" }{ $el } ) and $self->current_element eq 'item' ) { - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( $ns eq $self->{rss_namespace} ) { $self->{'items'}->[$self->{num_items}-1]->{ $el } = $attribs{resource};
From: jbisbee [...] cpan.org
Download (untitled) / with headers
text/plain 349b
[JBISBEE - Thu Jan 15 09:54:07 2004]: Just looked at Bug #4832 Uninitialized value -- bug report and a patch to fix it and have made a smaller patch that combines the fixes. (Namely simply doing ' my $ns = $self->namespace( $eq ) || "" ' at the start of the if, elsif block so you don't have to test if $ns is defined in the conditions.
Download XML-RSS-1.02.patch
text/x-diff 1.8k
Index: RSS.pm =================================================================== RCS file: /var/lib/cvs/cpan/XML-RSS-Feed/lib/XML/RSS.pm,v retrieving revision 1.1 diff -u -r1.1 RSS.pm --- RSS.pm 15 Jan 2004 14:06:30 -0000 1.1 +++ RSS.pm 15 Jan 2004 14:15:11 -0000 @@ -1475,7 +1475,7 @@ # beginning of item element } elsif ($el eq 'item') { # deal with trouble makers who use mod_content :) - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( (!$ns && !$self->{rss_namespace}) || @@ -1503,11 +1503,11 @@ $self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo'; } # beginning of a channel element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{ $self->namespace($el) || ""} ) and + exists( $rdf_resource_fields{ $self->namespace($el) || "" }{ $el } ) and $self->current_element eq 'channel' ) { - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( $ns eq $self->{rss_namespace} ) { $self->{channel}->{$el} = $attribs{resource}; @@ -1523,11 +1523,11 @@ } } # beginning of an item element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{ $self->namespace($el) || "" } ) and + exists( $rdf_resource_fields{ $self->namespace($el) || "" }{ $el } ) and $self->current_element eq 'item' ) { - my $ns = $self->namespace( $el ); + my $ns = $self->namespace( $el ) || ""; if ( $ns eq $self->{rss_namespace} ) { $self->{'items'}->[$self->{num_items}-1]->{ $el } = $attribs{resource};
From: jbisbee [...] cpan.org
Download (untitled) / with headers
text/plain 460b
[JBISBEE - Thu Jan 15 10:07:44 2004]: darn it, that was the old patch, here is the new one Show quoted text
> [JBISBEE - Thu Jan 15 09:54:07 2004]: > > Just looked at > > Bug #4832 Uninitialized value -- bug report and a patch to fix it > > and have made a smaller patch that combines the fixes. (Namely simply > doing ' my $ns = $self->namespace( $eq ) || "" ' at the start of the > if, elsif block so you don't have to test if $ns is defined in the > conditions.
Index: RSS.pm =================================================================== RCS file: /var/lib/cvs/cpan/XML-RSS-Feed/lib/XML/RSS.pm,v retrieving revision 1.1 diff -u -r1.1 RSS.pm --- RSS.pm 15 Jan 2004 14:06:30 -0000 1.1 +++ RSS.pm 15 Jan 2004 14:58:00 -0000 @@ -1,4 +1,4 @@ -# $Id: RSS.pm,v 1.1 2004/01/15 14:06:30 jbisbee Exp $ +# $Id: RSS.pm,v 1.22 2003/02/20 19:19:07 kellan Exp $ package XML::RSS; use strict; @@ -1429,6 +1429,7 @@ my %attribs = @_; # beginning of RSS 0.91 + my $ns = $self->namespace( $el ) || ""; if ($el eq 'rss') { if (exists($attribs{version})) { $self->{_internal}->{version} = $attribs{version}; @@ -1474,9 +1475,6 @@ # beginning of item element } elsif ($el eq 'item') { - # deal with trouble makers who use mod_content :) - my $ns = $self->namespace( $el ); - if ( (!$ns && !$self->{rss_namespace}) || ($ns eq $self->{rss_namespace}) @@ -1503,12 +1501,10 @@ $self->{'modules'}->{'http://purl.org/rss/1.0/modules/taxonomy/'} = 'taxo'; } # beginning of a channel element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{$ns} ) and + exists( $rdf_resource_fields{ $ns }{ $el } ) and $self->current_element eq 'channel' ) { - my $ns = $self->namespace( $el ); - if ( $ns eq $self->{rss_namespace} ) { $self->{channel}->{$el} = $attribs{resource}; } @@ -1523,12 +1519,10 @@ } } # beginning of an item element that stores its info in rdf:resource - elsif ( exists( $rdf_resource_fields{ $self->namespace($el) } ) and - exists( $rdf_resource_fields{ $self->namespace($el) }{ $el } ) and + elsif ( exists( $rdf_resource_fields{ $ns } ) and + exists( $rdf_resource_fields{ $ns }{ $el } ) and $self->current_element eq 'item' ) { - my $ns = $self->namespace( $el ); - if ( $ns eq $self->{rss_namespace} ) { $self->{'items'}->[$self->{num_items}-1]->{ $el } = $attribs{resource}; } else {


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

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