Skip Menu |

This queue is for tickets about the Class-DBI-FromCGI CPAN distribution.

Report information
The Basics
Id: 13179
Status: new
Priority: 0/
Queue: Class-DBI-FromCGI

People
Owner: Nobody in particular
Requestors: peterspeltz
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.94
Fixed in: (no value)

Attachments


Subject: Blanking out fields via update_from_cgi
If you untaint a hash of params with some undefined fields and thus Untaint returns the 'No parameter for' message , FromCGI does not blank out those fields. Instead it leaves them unchanged. Attached is patch and here is test. In a cgi environment blank inputs will be '' in the params to be untianted hovever CGI::Untaint needs a patch to treat those as 'No parameter for' cases. See bug reports for that. When that happens users can blank out fields that previously held a value. Now they have to set any empty params to undef. diff -u 01.orig.t 01.t --- 01.orig.t 2005-06-09 18:22:22.000000000 -0500 +++ 01.t 2005-06-09 19:16:19.032222576 -0500 @@ -7,7 +7,7 @@ BEGIN { eval "use DBD::SQLite"; - plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 77); + plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 83); } #------------------------------------------------------------------------- @@ -178,4 +178,19 @@ is (Water->untaint_type('wibble'), 'integer', "count is integer"); is (Water->untaint_type('foo'), undef, "no type for id"); +{ # Updating blank out empty fields + local @args{'id', 'title', 'count', 'wibble'} = ( 500, 'Test blank out field', 10,20); + my $h = CGI::Untaint->new(\%args); + my $new = Water->create_from_cgi($h); + isa_ok $new, 'Water'; + my ($id,$t,$c,$w) = ($new->id,$new->title, $new->count, $new->wibble); + %args = ( title => undef, count => undef); + $new->update_from_cgi(CGI::Untaint->new(\%args)); + ok !$new->cgi_update_errors, 'No update errors'; + is $id, $new->id, "id is $id and unchanged"; + is $w, $new->wibble , "wibble is $w and unchanged"; + ok !$new->title, "title was '$t' and now is '".$new->title."'"; + ok !$new->count, "count was $c and now is '".$new->count."'"; + $new->update; +} thanks
Download fcgi_update_patch
application/octet-stream 964b

Message body not shown because it is not plain text.