summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-07-20 19:55:55 +0200
committerlpsolit%gmail.com <>2007-07-20 19:55:55 +0200
commit1b984c1173997419539b419e68ce893fc0dee4ee (patch)
tree0e775e8f3e3f30328429b63cfddfb88628f543ea /Bugzilla/Search
parent92edb9c70d2297d0588a60ba700bd29c9670bb98 (diff)
downloadbugzilla-1b984c1173997419539b419e68ce893fc0dee4ee.tar.gz
bugzilla-1b984c1173997419539b419e68ce893fc0dee4ee.tar.xz
Bug 365082: QuickSearch using unknown field makes Bugzilla hang - Patch by Teemu Mannermaa <wicked@sci.fi> r/a=LpSolit
Diffstat (limited to 'Bugzilla/Search')
-rw-r--r--Bugzilla/Search/Quicksearch.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index e8664005c..884479e50 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -170,6 +170,7 @@ sub quicksearch {
$#words < Bugzilla->params->{'quicksearch_comment_cutoff'};
my @openStates = BUG_STATE_OPEN;
my @closedStates;
+ my @unknownFields;
my (%states, %resolutions);
foreach (@$legal_statuses) {
@@ -286,8 +287,11 @@ sub quicksearch {
my @fields = split(/,/, $1);
my @values = split(/,/, $2);
foreach my $field (@fields) {
- # Be tolerant about unknown fields
- next unless defined(MAPPINGS->{$field});
+ # Skip and record any unknown fields
+ if (!defined(MAPPINGS->{$field})) {
+ push(@unknownFields, $field);
+ next;
+ }
$field = MAPPINGS->{$field};
foreach (@values) {
addChart($field, 'substring', $_, $negate);
@@ -392,8 +396,13 @@ sub quicksearch {
$or = 0;
} # foreach (@words)
- # We've been very tolerant about invalid queries, so all that's left
- # may be an empty query.
+ # Inform user about any unknown fields
+ if (scalar(@unknownFields)) {
+ ThrowUserError("quicksearch_unknown_field",
+ { fields => \@unknownFields });
+ }
+
+ # Make sure we have some query terms left
scalar($cgi->param())>0 || ThrowUserError("buglist_parameters_required");
}