From 75645b089d19ff211dbf19007a7048c0e8f8b521 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 12 Jun 2013 16:38:43 +0800 Subject: Bug 882059: fix "use of uninitialized value" warnings, and ignore some errors/warnings --- Bugzilla/Auth.pm | 3 ++- Bugzilla/DB/Mysql.pm | 2 +- Bugzilla/Search/Quicksearch.pm | 3 +++ Bugzilla/Sentry.pm | 1 + buglist.cgi | 16 +++++++++------- extensions/Voting/Extension.pm | 1 + 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index ab741965a..7775a03c9 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -221,7 +221,8 @@ sub _handle_login_result { # For IPv6 we'll need to use inet_pton which requires Perl 5.12. my $n = inet_aton($address); if ($n) { - $address = gethostbyaddr($n, AF_INET) . " ($address)" + my $host = gethostbyaddr($n, AF_INET); + $address = "$host ($address)" if $host; } my $vars = { locked_user => $user, diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 9ddb46622..c430725ef 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -181,7 +181,7 @@ sub sql_fulltext_search { $mode = 'IN BOOLEAN MODE'; # quote un-quoted compound words - my @words = quotewords('[\s()]+', 'delimiters', $text); + my @words = grep { defined } quotewords('[\s()]+', 'delimiters', $text); foreach my $word (@words) { # match words that have non-word chars in the middle of them if ($word =~ /\w\W+\w/ && $word !~ m/"/) { diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 61e4a926a..48eaff8d1 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -214,6 +214,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); @@ -344,6 +345,7 @@ sub _handle_status_and_resolution { sub _handle_special_first_chars { my ($qsword, $negate) = @_; + return if $qsword eq ''; my $firstChar = substr($qsword, 0, 1); my $baseWord = substr($qsword, 1); @@ -415,6 +417,7 @@ sub _handle_field_names { $bug_status_set = 1; } foreach my $value (@values) { + next unless defined $value; my $operator = FIELD_OPERATOR->{$translated} || 'substring'; # If the string was quoted to protect some special # characters such as commas and colons, we need diff --git a/Bugzilla/Sentry.pm b/Bugzilla/Sentry.pm index 66106f13a..e0866b27e 100644 --- a/Bugzilla/Sentry.pm +++ b/Bugzilla/Sentry.pm @@ -52,6 +52,7 @@ use constant CONFIG => { qr/Could not check out .*\/cvsroot/, qr/Unicode character \S+ is illegal/, qr/Lost connection to MySQL server during query/, + qr/Call me again when you have some data to chart/, ], # (ab)use the logger to classify error/warning types diff --git a/buglist.cgi b/buglist.cgi index 2d81ed56d..27badae7c 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -490,14 +490,16 @@ elsif (($cmdtype eq "doit") && defined $cgi->param('remtype')) { or ThrowUserError('no_tag_to_edit', {action => $action}); my @buglist; - # Validate all bug IDs before editing tags in any of them. - foreach my $bug_id (split(/[\s,]+/, $cgi->param('bug_ids'))) { - next unless $bug_id; - push(@buglist, Bugzilla::Bug->check($bug_id)); - } + if ($cgi->param('bug_ids')) { + # Validate all bug IDs before editing tags in any of them. + foreach my $bug_id (split(/[\s,]+/, $cgi->param('bug_ids'))) { + next unless $bug_id; + push(@buglist, Bugzilla::Bug->check($bug_id)); + } - foreach my $bug (@buglist) { - $bug->$method($query_name); + foreach my $bug (@buglist) { + $bug->$method($query_name); + } } $vars->{'message'} = 'tag_updated'; diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index b8763b4df..aecd2382c 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -421,6 +421,7 @@ sub _page_user { # If a bug_id is given, and we're editing, we'll add it to the votes list. my $bug_id = $input->{bug_id}; + $bug_id = $bug_id->[0] if ref($bug_id) eq 'ARRAY'; my $bug = Bugzilla::Bug->check($bug_id) if $bug_id; my $who_id = $input->{user_id} || $user->id; -- cgit v1.2.3-24-g4f1b