Project

General

Profile

Actions

Bug #2679

closed

PHP warnings in diag_states_summary.php

Added by Thomas NOEL over 11 years ago. Updated over 9 years ago.

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

100%

Estimated time:
Plus Target Version:
Release Notes:
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=...").

Actions #1

Updated by Ermal Luçi over 11 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.

Actions #2

Updated by Ermal Luçi over 11 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #3

Updated by Thomas NOEL over 11 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)

Actions #4

Updated by Ermal Luçi over 11 years ago

Actions #5

Updated by Renato Botelho over 9 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF