Project

General

Profile

Actions

Bug #4281

closed

E-Mail Reports (mailreports package) Error With Multiple Graphs

Added by Bryce Chidester over 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
01/24/2015
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Affected Version:
Affected Plus Version:
Affected Architecture:

Description

When a report has multiple graphs, the following errors are generated while generating graphs 2-N

Warning: Cannot use a scalar value as an array in /etc/inc/mail_reports.inc on line 247
Warning: header(): Cannot change zlib.output_compression - headers already sent in /etc/inc/mail_reports.inc on line 1178

The global variable $g is re-cast/reused within mail_report_generate_graph(), causing subsequent calls to the function to elicit the above errors.
Note that this is related to #3503.

A patch is forthcoming.

Actions #1

Updated by Bryce Chidester over 9 years ago

Simple patch to rename the temporary variable that's conflicting with the global $g.

--- mail_reports.inc.orig       2015-01-24 13:53:21.000000000 -0800
+++ mail_reports.inc    2015-01-24 13:57:42.000000000 -0800
@@ -531,7 +531,7 @@
                $graphcmd .= "--height 200 --width 620 ";

                $iflist = get_configured_interface_list();
-               $g = 0;
+               $h = 0;
                $operand = "";
                $comma = "";
                $graphtputbip = "";
@@ -577,7 +577,7 @@
                        $graphcmd .= "CDEF:\"{$ifname}-bytes_out_t_block={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes_block,IF,$seconds,*\" ";
                        $graphcmd .= "CDEF:\"{$ifname}-bytes_t_pass={$ifname}-bytes_in_t_pass,{$ifname}-bytes_out_t_pass,+\" ";
                        $graphcmd .= "CDEF:\"{$ifname}-bytes_t_block={$ifname}-bytes_in_t_block,{$ifname}-bytes_out_t_block,+\" ";
-                       if ($g > 0) {
+                       if ($h > 0) {
                                $operand .= ",+";
                                $comma = ",";
                        }
@@ -593,7 +593,7 @@
                        $graphtputbyob .= "{$comma}{$ifname}-bytes_out_t_block";
                        $graphtputbytp .= "{$comma}{$ifname}-bytes_t_pass";
                        $graphtputbytb .= "{$comma}{$ifname}-bytes_t_block";
-                       $g++;
+                       $h++;
                }
                $graphcmd .= "CDEF:\"tput-in_bits_pass={$graphtputbip}{$operand}\" ";
                $graphcmd .= "CDEF:\"tput-out_bits_pass={$graphtputbop}{$operand}\" ";
Actions #2

Updated by Jim Pingle over 9 years ago

  • Project changed from pfSense to pfSense Packages
  • Assignee set to Jim Pingle

I've got some other bugs to fix there already (such as updating the mail library). I plan to work on it this week if I have time.

Actions #3

Updated by Bryce Chidester over 9 years ago

Thanks for fixing the project - didn't realize which project I was in when I opened the issue.

I went ahead and opened a pullreq on Github too, in case that makes this easier to address. (Then again, it's a very simple patch.)
https://github.com/pfsense/pfsense-packages/pull/793

Actions #4

Updated by Bryce Chidester about 9 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

Applied in changeset commit:b852b5cd883b3d059bc3744fc7b130531a5f20ed.

Actions #5

Updated by Jim Pingle over 8 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF