Item14071: Register script reports zero values as missing registration fields.
Priority: Normal
Current State: Closed
Released In: 2.1.3
Target Release: patch
Here are the lines 1898 to 1904 in the file:
*
my @missing = ();
foreach my $fd ( sort { $a->{name} cmp $b->{name} } @{ $data->{form} } )
{
if ( ( $fd->{required} ) && ( !$fd->{value} ) ) {
push( @missing, $fd->{name} );
}
}
*
This piece of code on line 1901, !$fd->{value}, is a bug because it would fail to detect the input 0 which is a legitimate input (one application I've worked on accepts 0 as a valid input). The input should be explicitly tested against empty string, $fd->{value} eq '', or $fd->{value} =~ /^\s*$/ if non-white-space input is to be enforced.
--
ShipingZhang - 15 May 2016
Thanks for the report and the suggested patch. It will be fixed in 2.1.3. The Form field processing treats mandatory fields as having length > 0, So enforcing non-white-space isn't consistent.
--
GeorgeClark - 10 Nov 2016