diff options
author | Phil Davis <phil.davis@inf.org> | 2017-01-19 10:22:07 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-01-19 10:21:51 -0200 |
commit | 59ffba2fb71fcb20e48d8430afd6f06e90dcc0cc (patch) | |
tree | 6455ddd74599255539477d97c05dbacdcd10074b /src/usr/local | |
parent | 18d0560946842ebf4575a38b00198fe83f46275e (diff) | |
download | pfsense-59ffba2fb71fcb20e48d8430afd6f06e90dcc0cc.zip pfsense-59ffba2fb71fcb20e48d8430afd6f06e90dcc0cc.tar.gz |
Fix #7134 Interface Stats widget ifdescrs not defined
When doing testing I had the Interfaces widget open as well as Interface Statistics. $ifdescrs was already populated as an array by the Interfaces widget, so Interface Statistics had (accidentally) gained the benefit.
If you have just the Interface Statistics widget on the dashboard then you get the reported PHP error, in the code that sets up the checkbox array of selectable interfaces. The problem is fixed by always calling get_configured_interface_with_descr() at the top of this code, rather than calls that were just inside various if() cases.
Note: get_configured_interface_with_descr() in util.inc always returns an array, even if an empty one, so the ```if (!is_array($ifdescrs))``` testing should not be needed.
(cherry picked from commit 8f94fc33f07718141f332a567df7b30f91c38c93)
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/widgets/widgets/interface_statistics.widget.php | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php index 8685f6c..be27757 100644 --- a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php +++ b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php @@ -65,6 +65,8 @@ require_once("pfsense-utils.inc"); require_once("functions.inc"); require_once("/usr/local/www/widgets/include/interface_statistics.inc"); +$ifdescrs = get_configured_interface_with_descr(); + // Compose the table contents and pass it back to the ajax caller if ($_REQUEST && $_REQUEST['ajax']) { @@ -78,10 +80,6 @@ if ($_REQUEST && $_REQUEST['ajax']) { 'collisions' => gettext('Collisions'), ); - $ifdescrs = get_configured_interface_with_descr(); - if (!is_array($ifdescrs)) { - $ifdescrs = array(); - } $skipinterfaces = explode(",", $user_settings['widgets']['interface_statistics']['iffilter']); print("<thead>"); @@ -126,10 +124,6 @@ if ($_REQUEST && $_REQUEST['ajax']) { exit; } else if ($_POST) { - $ifdescrs = get_configured_interface_with_descr(); - if (!is_array($ifdescrs)) { - $ifdescrs = array(); - } $validNames = array(); foreach ($ifdescrs as $ifdescr => $ifname) { |