Skip Menu |

This queue is for tickets about the CGI-Untaint CPAN distribution.

Report information
The Basics
Id: 4466
Status: resolved
Priority: 0/
Queue: CGI-Untaint

People
Owner: Nobody in particular
Requestors: mark [...] twoshortplankks.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.83
Fixed in: (no value)



Subject: Errors not set on false values, items returned
Consider: package CGI::Untaint::twodigit; use base qw(CGI::Untaint::object); sub _untaint_re { return qr/^\s*([0-9]{2})\s*$/ } 1; Now consider these tests: #!/usr/bin/perl -w use strict; use Test::More tests => 2; unextractable("","twodigit","0 digit"); unextractable("0","twodigit","1 digit zero"); Both of these fail because of this line in the source: # 'False' values get returned as themselves with no warnings. return $self->{value} unless $self->{value}; In all other places CGI::Untaint->extract returns an empty list when it can't extract something (this is useful, it allows you to tell returning of undef and returning due to failure apart) and sets an error condition. This does neither, it simply 'approves' all false values without running them through the untaint
Show quoted text
> package CGI::Untaint::twodigit; > sub _untaint_re { return qr/^\s*([0-9]{2})\s*$/ }
Show quoted text
> unextractable("","twodigit","0 digit"); > unextractable("0","twodigit","1 digit zero");
The other changes I made today seem to have fixed this. However I've added this as a regression test in 1.25. Thanks, Tony