[html-formfu] [patch] bug in Constraint::MinMaxFields

Ronald J Kimball rkimball+formfu at pangeamedia.com
Fri Nov 21 20:38:51 GMT 2008


Also, I notice that the documentation for MinMaxFields says that 
attach_errors_to_base and attach_errors_to_others both default to 1.  In 
the code, however, only attach_errors_to_base defaults to 1.  What is 
the correct behavior here?

thanks,
Ronald


Ronald J Kimball wrote:
> I just discovered a little bug in the MinMaxFields constraint.  The code 
> that sets the default value for $max assumes that $others is an array ref:
> 
>     my $max = defined $self->maximum ? $self->maximum
>             :                          1 + scalar @$others;
> 
> However, $others can sometimes be a single value, which is accounted for 
> later in the code:
> 
>     push @names, ref $others ? @{$others} : $others;
> 
> 
> Patch attached.  Includes a new test that fails with the existing code 
> and succeeds with the patch applied.
> 
> Ronald
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




More information about the HTML-FormFu mailing list