• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6654: LoginManager::Session calls nonexistant CGI method

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine LoginManager Normal New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

Symptoms and impact

When trying to use the GenPDF extension with the 5.0.1 I've received following error after running genpdf script:

Undefined subroutine CGI::remoteAddress
 at /srv/www/twiki/lib/TWiki/LoginManager/Session.pm line 45
 at /usr/lib/perl5/5.12.1/CGI.pm line 893
   CGI::_compile called at /usr/lib/perl5/5.12.1/CGI.pm line 857
   CGI::AUTOLOAD('CGI=HASH(0x8cab50)') called at /srv/www/twiki/lib/TWiki/LoginManager/Session.pm line 45
   TWiki::LoginManager::Session::load('TWiki::LoginManager::Session', undef, 'CGI=HASH(0x8cab50)', 'HASH(0x14d6e70)') called at /usr/lib/perl5/vendor_perl/5.12.1/CGI/Session.pm line 64
   CGI::Session::new('TWiki::LoginManager::Session', undef, 'CGI=HASH(0x8cab50)', 'HASH(0x14d6e70)') called at /srv/www/twiki/lib/TWiki/LoginManager.pm line 321
   TWiki::LoginManager::loadSession('TWiki::LoginManager::TemplateLogin=HASH(0x142a940)', undef) called at /srv/www/twiki/lib/TWiki/Users.pm line 115
   TWiki::Users::new('TWiki::Users', 'TWiki=HASH(0x120c168)') called at /srv/www/twiki/lib/TWiki.pm line 1552
   TWiki::new('TWiki', undef, 'CGI=HASH(0x8cab50)') called at /srv/www/twiki/lib/TWiki.pm line 3342
   TWiki::initialize('/TWiki/GenPDFAddOn', undef, undef, 'http://localhost/twiki/bin/genpdf', 'CGI=HASH(0x8cab50)') called at /srv/www/twiki/lib/TWiki/Contrib/GenPDF.pm line 595
   TWiki::Contrib::GenPDF::viewPDF() called at /srv/www/twiki/bin/genpdf line 43

This effectively made the GenPDF unusable with 5.0.1 (probably 5.0.0 has the same issue as noted in the dev discussion for the plugin).

Details

LoginManager::Session has load method that looks like this in 5.0.1:

     42    sub load {
     43     my $this = shift;
     44     # local %ENV; # TWikibug:Item6583 - commented out
     45     $ENV{REMOTE_ADDR} = @_ == 1 ? $_[0]->remoteAddress : $_[1]->remoteAddress;
     46     $this->SUPER::load(@_);
     47 }

There is a bug in line 45, because the CGI object that is passed as the argument does not have method called remoteAddress - the relevant method is called remote_addr. Seems like someone misspelled the method name.

Fix

I've changed line 45 to:

$ENV{REMOTE_ADDR} = @_ == 1 ? $_[0]->remote_addr : $_[1]->remote_addr;

GenPDF is working again in 5.0.1 after the fix. I don't see any potential side effects.

ItemTemplate
Summary LoginManager::Session calls nonexistant CGI method
ReportedBy TWiki:Main.SzymonSobczyk
Codebase 5.0.1
SVN Range TWiki-5.0.1, Tue, 11 Jan 2011, build 20174
AppliesTo Engine
Component LoginManager
Priority Normal
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Topic revision: r1 - 2011-03-04 - SzymonSobczyk
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback