Project

General

Profile

Bug #7134

Crash in the gui related to widget

Added by Alexandre Paradis 2 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Web Interface
Target version:
Start date:
01/18/2017
Due date:
% Done:

100%

Affected version:
2.4
Affected Architecture:

Description

From thread : https://forum.pfsense.org/index.php?topic=124155.0

Other people seems to have the same bug.

My crash info :
amd64
11.0-RELEASE-p6
FreeBSD 11.0-RELEASE-p6 #67 69cfe67ee69(RELENG_2_4): Tue Jan 17 18:35:56 CST 2017 :/builder/ce/tmp/obj/builder/ce/tmp/FreeBSD-src/sys/pfSense

Crash report details:

PHP Errors:
[18-Jan-2017 01:26:13 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 01:26:13 America/Toronto] PHP Stack trace:
[18-Jan-2017 01:26:13 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 01:26:13 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401
[18-Jan-2017 01:26:14 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 01:26:14 America/Toronto] PHP Stack trace:
[18-Jan-2017 01:26:14 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 01:26:14 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401
[18-Jan-2017 01:26:16 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 01:26:16 America/Toronto] PHP Stack trace:
[18-Jan-2017 01:26:16 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 01:26:16 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401
[18-Jan-2017 01:32:55 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 01:32:55 America/Toronto] PHP Stack trace:
[18-Jan-2017 01:32:55 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 01:32:55 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401
[18-Jan-2017 01:34:22 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 01:34:22 America/Toronto] PHP Stack trace:
[18-Jan-2017 01:34:22 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 01:34:22 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401
[18-Jan-2017 11:14:38 America/Toronto] PHP Warning: Invalid argument supplied for foreach() in /usr/local/www/widgets/widgets/interface_statistics.widget.php on line 137
[18-Jan-2017 11:14:38 America/Toronto] PHP Stack trace:
[18-Jan-2017 11:14:38 America/Toronto] PHP 1. {main}() /usr/local/www/index.php:0
[18-Jan-2017 11:14:38 America/Toronto] PHP 2. include_once() /usr/local/www/index.php:401

No FreeBSD crash data found.

Associated revisions

Revision ffb0c182
Added by Jim Pingle 2 months ago

Protect against forech errors if this function does not return an array. Fixes #7134

Revision 71d90bbf
Added by Jim Pingle 2 months ago

Protect against forech errors if this function does not return an array. Fixes #7134

Revision 8f94fc33
Added by Phillip Davis 2 months ago

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.

Revision 59ffba2f
Added by Phillip Davis 2 months ago

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)

History

#1 Updated by Jim Pingle 2 months ago

  • Status changed from New to Confirmed

This also happens on 2.3.3

#2 Updated by Jim Pingle 2 months ago

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

#3 Updated by Phillip Davis 2 months ago

If you have just the Interface Statistics widget on the dashboard (and not the Interfaces widget also) then you still get this PHP error crash report.
Proposed "final solution" in PR https://github.com/pfsense/pfsense/pull/3396

#4 Updated by Jim Pingle 2 months ago

  • Status changed from Feedback to Resolved

Your fix looks good, Phil. The system I could replicate this on is no longer producing errors after a gitsync.
Thanks!

#5 Updated by Jim Pingle about 2 months ago

  • Target version changed from 2.4.0 to 2.3.3

Also available in: Atom PDF