From 973b61c083c83927b552c8985c1d8febe6847f72 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 15 Mar 2018 17:44:47 -0400 Subject: Bug 1443058 - Backport 1087400 to bmo - CGI 4.05 throws tons of "CGI::param called in list context" warnings --- Bugzilla/CGI.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Bugzilla/CGI.pm') 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(@_); -- cgit v1.2.3-24-g4f1b From 7431f5772abfc859f830ad9f075dfe7b210e4a31 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Tue, 20 Mar 2018 17:36:36 -0400 Subject: no bug - remove debugging for now --- Bugzilla/CGI.pm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'Bugzilla/CGI.pm') diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index cd947841e..b0bc15e78 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -600,16 +600,18 @@ sub param { # 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"); + if (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 } - ## use critic # When we are just requesting the value of a parameter... if (scalar(@_) == 1) { -- cgit v1.2.3-24-g4f1b