From 64c86cceda19b7ec970fa0118913c37d5382eb32 Mon Sep 17 00:00:00 2001 From: "bzrmirror%bugzilla.org" Date: Mon, 23 Sep 2013 14:48:21 +0000 Subject: [PATCH] Bug 918647: "Use of uninitialized value" warnings when using quicksearch r=simon, a=glob git-svn-id: svn://10.0.0.236/trunk@265027 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/.bzrrev | 2 +- mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/webtools/bugzilla/.bzrrev b/mozilla/webtools/bugzilla/.bzrrev index 766e24a3571..e47037e21a6 100644 --- a/mozilla/webtools/bugzilla/.bzrrev +++ b/mozilla/webtools/bugzilla/.bzrrev @@ -1 +1 @@ -8749 \ No newline at end of file +8750 \ No newline at end of file diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm index 8bd5029a753..c07c8ba0321 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Quicksearch.pm @@ -196,6 +196,7 @@ sub quicksearch { foreach my $qsword (@qswords) { my @or_operand = _parse_line('\|', 1, $qsword); foreach my $term (@or_operand) { + next unless defined $term; my $negate = substr($term, 0, 1) eq '-'; if ($negate) { $term = substr($term, 1); @@ -262,6 +263,8 @@ sub quicksearch { sub _parse_line { my ($delim, $keep, $line) = @_; + return () unless defined $line; + # parse_line always treats ' as a quote character, making it impossible # to sanely search for contractions. As this behavour isn't # configurable, we replace ' with a placeholder to hide it from the @@ -276,7 +279,7 @@ sub _parse_line { my @words = parse_line($delim, $keep, $line); foreach my $word (@words) { - $word =~ tr/\000/'/; + $word =~ tr/\000/'/ if defined $word; } return @words; } @@ -348,6 +351,7 @@ sub _handle_status_and_resolution { sub _handle_special_first_chars { my ($qsword, $negate) = @_; + return 0 if !defined $qsword || length($qsword) <= 1; my $firstChar = substr($qsword, 0, 1); my $baseWord = substr($qsword, 1);