You are here: Foswiki>Tasks Web>Item12145 (30 Dec 2014, GeorgeClark)Edit Attach

Item12145: Bug Report: No error checking for undefined arguments to getPreference in Meta.pm

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: FoswikiMeta
Branches:
Reported By: ElaineRichards
Waiting For:
Last Change By: GeorgeClark
My user received the internal error message on his screen: Can't call method "get" on an undefined value

This comes right out from the underlying Perl. The error logs pointed to a line in Meta.pm


../lib/Foswiki/Meta.pm

sub getPreference {
    my ( $this, $key ) = @_;

    unless ( $this->{_web} || $this->{_topic} ) {
        return $this->{_session}->{prefs}->getPreference($key);  <<--This is the line in question
(etc)

The subroutine getPreference is called, in a number of cases, with a single argument. I suspect that there is an assumption that this value is a global variable.

$key is undefined. It'd be more useful for the user to get an error message being specific about what exactly is undefined, so they can fix their page right away. In this case, the user's page is pretty complex and includes other pages, so a message about which value is not defined would help us avoid a long process of going through his page and all the pages that are included.

-- ElaineRichards - 12 Oct 2012

 

We really need to see the stack trace that led to this report, if it's available. getPreference should never be called with no parameters (or a null parameter).

-- CrawfordCurrie - 25 Oct 2012

No feedback for 2 years ... setting to No Action.

-- GeorgeClark - 30 Dec 2014

ItemTemplate edit

Summary Bug Report: No error checking for undefined arguments to getPreference in Meta.pm
ReportedBy ElaineRichards
Codebase 1.1.5
SVN Range
AppliesTo Engine
Component FoswikiMeta
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r4 - 30 Dec 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy