diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-03-15 22:44:47 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-03-18 04:50:10 +0100 |
commit | 5f4ef66e740f2677df00894510c1a675060f13fa (patch) | |
tree | fa16f1625bdf8ba0380aca725a5a8a514c45bdec | |
parent | 448bd3acdc1bcb33070f15f11b6464f861dffaae (diff) | |
download | bugzilla-5f4ef66e740f2677df00894510c1a675060f13fa.tar.gz bugzilla-5f4ef66e740f2677df00894510c1a675060f13fa.tar.xz |
Bug 1443058 - Backport 1087400 to bmo - CGI 4.05 throws tons of "CGI::param called in list context" warnings
-rw-r--r-- | Bugzilla/CGI.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 3737b97e2..cd947841e 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -11,6 +11,7 @@ use 5.10.1; use strict; use warnings; +use Bugzilla::Logging; use CGI; use base qw(CGI); @@ -597,6 +598,19 @@ sub header { sub param { my $self = shift; + # We don't let CGI.pm warn about list context, but we do it ourselves. + local $CGI::LIST_CONTEXT_WARN = 0; + state $has_warned = {}; + + ## no critic (Freenode::Wantarray) + if ( wantarray && @_ ) { + my ( $package, $filename, $line ) = caller; + if ( $package ne 'CGI' && ! $has_warned->{"$filename:$line"}++) { + WARN("Bugzilla::CGI::param called in list context from $package $filename:$line"); + } + } + ## use critic + # When we are just requesting the value of a parameter... if (scalar(@_) == 1) { my @result = $self->SUPER::param(@_); |