Project

General

Profile

Bug #2679

PHP warnings in diag_states_summary.php

Added by Thomas NOEL about 7 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
11/12/2012
Due date:
% Done:

100%

Estimated time:
Affected Version:
2.0.1
Affected Architecture:
All

Description

When there is a lot of clients, there is a lot of these warnings in /tmp/PHP_erros.log :

[12-Nov-2012 12:32:04] PHP Warning:  asort() expects parameter 1 to be array, null given in /usr/local/www/diag_states_summary.php on line 107
[12-Nov-2012 12:32:04] PHP Warning:  array_reverse(): The argument should be an array in /usr/local/www/diag_states_summary.php on line 108
[12-Nov-2012 12:32:04] PHP Warning:  Invalid argument supplied for foreach() in /usr/local/www/diag_states_summary.php on line 108

Here is a patch :

--- a/usr/local/www/diag_states_summary.php
+++ b/usr/local/www/diag_states_summary.php
@@ -103,6 +103,8 @@ function sort_by_ip($a, $b) {
 }

 function build_port_info($portarr, $proto) {
+       if (! $portarr)
+               return '';
        $ports = array();
        asort($portarr);
        foreach (array_reverse($portarr, TRUE) as $port => $count) {

(However, I don't understand why we need this function, because its result is not shown ; it is just used in two "span title=...").

Associated revisions

Revision 3f00208a (diff)
Added by Ermal Luçi about 7 years ago

Resolves #2679. Correct behaviour when port is null to avoid warnings on error log

Revision 1bceebd0 (diff)
Added by Jim Pingle about 7 years ago

Fix variable reference, ticket #2679

Revision 69fec196 (diff)
Added by Ermal Luçi about 7 years ago

Resolves #2679. Correct behaviour when port is null to avoid warnings on error log

History

#1 Updated by Ermal Luçi about 7 years ago

I would suggest you to use github for such fixes.
It makes it a lot easier to commit and review patches.

Redmine is useful for tracking an issue.
You have both the issue/analysis/fix so github helps here.

#2 Updated by Ermal Luçi about 7 years ago

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

#3 Updated by Thomas NOEL about 7 years ago

I think there is an error in the commited patch : "if (!portarr)" instead of "if (!$portarr)"

(and yes, I start use github asap)

#4 Updated by Ermal Luçi about 7 years ago

#5 Updated by Renato Botelho over 5 years ago

  • Status changed from Feedback to Resolved

Also available in: Atom PDF