Item8401: default="0" is incorrectly handled as default="" when setting the selected options
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