From 470620fa7405b1dd7bb8f83f54b8b12423062b55 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 10 Nov 2005 07:24:13 +0000 Subject: =?UTF-8?q?Bug=20315339:=20User::match=5Ffield()=20now=20leaves=20?= =?UTF-8?q?fields=20undefined=20instead=20of=20as=20empty=20strings=20when?= =?UTF-8?q?=20no=20value=20is=20passed=20-=20Patch=20by=20Fr=C3=A9d=C3=A9r?= =?UTF-8?q?ic=20Buclin=20=20r=3Dwicked=20a=3Dmyk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/User.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 701c1c2b2..88a7f0e49 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -952,9 +952,13 @@ sub match_field { my $raw_field = join(" ", $cgi->param($field)); # When we add back in values later, it matters that we delete - # the param here, and not set it to '', so that we will add + # the field here, and not set it to '', so that we will add # things to an empty list, and not to a list containing one - # empty string + # empty string. + # If no match or more than one match is found for this field, + # we will set it back to '' so that the field remains defined + # outside this function (it was if we came here; else we would + # have returned ealier above). $cgi->delete($field); my @queries = (); @@ -1039,6 +1043,11 @@ sub match_field { $need_confirm = 1; # confirmation screen shows failures } } + # Above, we deleted the field before adding matches. If no match + # or more than one match has been found, we set it back to '' so + # that the caller of this function can still check whether this + # field was defined or not (and it was if we came here). + $cgi->param($field, '') unless defined $cgi->param($field); } my $retval; -- cgit v1.2.1