Subject: | Use of uninitialized value in numeric eq (==) at /usr/lib/perl5/site_perl/5.8.0/CGI/Session.pm line 295. |
Periodically we receive these. It appears perl can mistakenly call DESTROY() twice for the same object.
2005-09-15 08:14:55 [24571] EXCEPTION
Use of uninitialized value in numeric eq (==) at /usr/lib/perl5/site_perl/5.8.0/CGI/Session.pm line 295.
[/usr/lib/perl5/site_perl/5.8.0/CGI/Session.pm:295]
[/usr/lib/perl5/site_perl/5.8.0/CGI/Session.pm:204]
One solution that appears to work is to check if $self->{_STATUS} is defined before testing the value. These appeared in both the 3.95 and 4.00 series, although much less frequently in the newer modules.
Something like the attached patch seems to fix it completely.
*** Session.pm.orig 2005-09-15 12:21:35.000000000 -0400
--- Session.pm 2005-09-15 12:22:23.000000000 -0400
***************
*** 292,298 ****
my $self = shift;
return unless $self->id; # <-- empty session
! return if $self->{_STATUS} == 0; # <-- neither new, nor deleted nor modified
if ( $self->_test_status(STATUS_NEW) && $self->_test_status(STATUS_DELETED) ) {
$self->{_DATA} = {};
--- 292,298 ----
my $self = shift;
return unless $self->id; # <-- empty session
! return if !defined($self->{_STATUS}) or $self->{_STATUS} == 0; # <-- neither new, nor deleted nor modified
if ( $self->_test_status(STATUS_NEW) && $self->_test_status(STATUS_DELETED) ) {
$self->{_DATA} = {};