Item8401: default="0" is incorrectly handled as default="" when setting the selected options

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
Applies To: Extension
Component: FormPlugin
Branches:
Reported By: Foswiki::Main.DiabJerius
Waiting For:
Last Change By: ArthurClemens
The logic in FormPlugin.pm to set the selected options is faulty because it turns a string into a boolean, which fails if the string has a value of "0" (See Perl Best Practices, P. 184 "Missing Arguments"). This happens first here:

   1077     my $selectedoptions = $params->{'default'} || undef;

and is repeated elsewhere in varying guises. I've attached a patch against rev 5599 which fixes this particular set of problems.

There is similar incorrect logic elsewhere in the code, but unfortunately I've run out of time to look at those.

-- DiabJerius - 20 Jan 2010

The patch does other things wrong so I won't use it as is, but you are right that I need to check for "wrong falses".

-- ArthurClemens - 18 May 2010

Fixed with release 1.6.

-- ArthurClemens - 26 May 2010

 

ItemTemplate edit

Summary default="0" is incorrectly handled as default="" when setting the selected options
ReportedBy Foswiki::Main.DiabJerius
Codebase trunk
SVN Range 5599
AppliesTo Extension
Component FormPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
I Attachment Action Size Date Who Comment
FormPlugin.patchpatch FormPlugin.patch manage 2 K 20 Jan 2010 - 22:59 DiabJerius Patch
Topic revision: r4 - 26 May 2010, ArthurClemens
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