Date: | Mon, 07 Mar 2005 11:52:09 -0800 |
Subject: | Bug with non-required params in Untaint+FromCGI |
From: | Michael Reece <mreece [...] sacbee.com> |
To: | <bug-CGI-Untaint [...] rt.cpan.org> |
Greetings. It appears that in the latest release (1.25) of Untaint, the
behavior for false values was changed. This is commented out:
# 'False' values get returned as themselves with no warnings.
# return $self->{__lastval} unless $self->{__lastval};
So now trying to untaint an empty printable field gives the error '() does
not untaint with default pattern'
However, Class::CGI::FromCGI does not deal with this well, and reports the
error.
I have patched this in FromCGI.pm's sub validate by changing
if ($required{$field} and not $value) {
$them->{_cgi_update_error}->{$field} = "You must supply '$field'"
- } elsif ($err) {
$them->{_cgi_update_error}->{$field} = $err
unless $err =~ /^No parameter for/;
} else {
$fields->{$field} = $value
}
to:
if ($required{$field} and not $value) {
$them->{_cgi_update_error}->{$field} = "You must supply '$field'"
+ } elsif ($err && $value) {
$them->{_cgi_update_error}->{$field} = $err
unless $err =~ /^No parameter for/;
} else {
$fields->{$field} = $value
}
--
michael reece :: web engineer :: mreece@sacbee.com :: (916)321-1249