]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1443058 - Backport 1087400 to bmo - CGI 4.05 throws tons of "CGI::param called...
authorDylan William Hardison <dylan@hardison.net>
Thu, 15 Mar 2018 21:44:47 +0000 (17:44 -0400)
committerGitHub <noreply@github.com>
Thu, 15 Mar 2018 21:44:47 +0000 (17:44 -0400)
Bugzilla/CGI.pm

index 3737b97e28d6feed5b8284d94f819592b3893de5..cd947841e2e4fa16a6bd9ec0ae5f96e30c3e57ca 100644 (file)
@@ -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(@_);