Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix array/hash lookup errors when data is missing
Say you mispell your iface name in the config, or try to target a device that vnstat is not configured to monitor, you will get lots of the following: PHP Warning: Illegal string offset 'rx' in /home/joe/public_html/vnstat/index.php on line 104 PHP Warning: Illegal string offset 'tx' in /home/joe/public_html/vnstat/index.php on line 105 This checks if vnstat gives an error. If it does, it leaves the $hour/$month/$day variables empty rather than making them 'nodata'. In places where data is expected (in the graphs and table generation) the time variables are now checked against being empty rather than 'nodata' which further fixes warnings like the following: PHP Notice: Undefined index: totalrx in /home/joe/public_html/vnstat-php-frontend/index.php on line 86 PHP Notice: Undefined index: totalrxk in /home/joe/public_html/vnstat-php-frontend/index.php on line 86 PHP Notice: Undefined index: totaltx in /home/joe/public_html/vnstat-php-frontend/index.php on line 87 PHP Notice: Undefined index: totaltxk in /home/joe/public_html/vnstat-php-frontend/index.php on line 87
- Loading branch information
Showing
4 changed files
with
35 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters