summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search.pm
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2014-01-03 00:02:27 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2014-01-03 00:02:27 +0100
commitfd32a1a35d928726c4f9c06d1c573825672a29d6 (patch)
tree32f86900f63849301f95011de53053b535e58d3d /Bugzilla/Search.pm
parentfc5aae4091324a630fee712984b1a643e45e3197 (diff)
downloadbugzilla-fd32a1a35d928726c4f9c06d1c573825672a29d6.tar.gz
bugzilla-fd32a1a35d928726c4f9c06d1c573825672a29d6.tar.xz
Bug 543432: [PostgreSQL] Crash when typing a string in combination with a numeric field
r=dkl a=sgreen
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r--Bugzilla/Search.pm7
1 files changed, 7 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index e546be6d9..2d1f3af11 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1997,11 +1997,18 @@ sub _quote_unless_numeric {
my $numeric_field = $self->_chart_fields->{$field}->is_numeric;
my $numeric_value = ($value =~ NUMBER_REGEX) ? 1 : 0;
my $is_numeric = $numeric_operator && $numeric_field && $numeric_value;
+
+ # These operators are really numeric operators with numeric fields.
+ $numeric_operator = grep { $_ eq $operator } keys SIMPLE_OPERATORS;
+
if ($is_numeric) {
my $quoted = $value;
trick_taint($quoted);
return $quoted;
}
+ elsif ($numeric_field && !$numeric_value && $numeric_operator) {
+ ThrowUserError('number_not_numeric', { field => $field, num => $value });
+ }
return Bugzilla->dbh->quote($value);
}