Subject: | 0(zero) is true when returned from custom subs in contraint_methods |
This combination doesn't work as expected:
constraint_methods => {
signcode => sub { $is_signcode_valid },
},
},
untaint_all_constraints => 1,
If $is_signcode_valid contrains zero it still is interpreted as true
when untainting is requested.
This code in Data/FormValidator/Results.pm is at fault:
sub _constraint_check_match {
...
# We need to make this distinction when untainting,
# to allow untainting values that are defined but not true,
# such as zero.
my $success;
if (defined $match) {
$success = ($untaint_this) ? length $match : $match;
}
...
length(0) is obviously true. I don't really understand the intention so
I don't know what's the right way to fix it.