From: Byron Jones Date: Fri, 7 Jun 2013 05:27:25 +0000 (+0800) Subject: Bug 880315: Fix malformed sql generated by the fix for bug 879055 X-Git-Tag: bugzilla-4.5.1~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e16a58fe9a949c4344a41e007279278b476141d;p=thirdparty%2Fbugzilla.git Bug 880315: Fix malformed sql generated by the fix for bug 879055 r=LpSolit, a=LpSolit --- diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 0f395bde96..7205f09c5e 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -2926,14 +2926,14 @@ sub _anywordsubstr { my ($self, $args) = @_; my @terms = $self->_substring_terms($args); - $args->{term} = '(' . join("\n\tOR ", @terms) . ')'; + $args->{term} = @terms ? '(' . join("\n\tOR ", @terms) . ')' : ''; } sub _allwordssubstr { my ($self, $args) = @_; my @terms = $self->_substring_terms($args); - $args->{term} = '(' . join("\n\tAND ", @terms) . ')'; + $args->{term} = @terms ? '(' . join("\n\tAND ", @terms) . ')' : ''; } sub _nowordssubstr { @@ -2950,14 +2950,14 @@ sub _anywords { # Because _word_terms uses AND, we need to parenthesize its terms # if there are more than one. @terms = map("($_)", @terms) if scalar(@terms) > 1; - $args->{term} = '(' . join("\n\tOR ", @terms) . ')'; + $args->{term} = @terms ? '(' . join("\n\tOR ", @terms) . ')' : ''; } sub _allwords { my ($self, $args) = @_; my @terms = $self->_word_terms($args); - $args->{term} = '(' . join("\n\tAND ", @terms) . ')'; + $args->{term} = @terms ? '(' . join("\n\tAND ", @terms) . ')' : ''; } sub _nowords {