Skip to content

Commit

Permalink
Merge pull request #18 from piotrmacha/fix/17
Browse files Browse the repository at this point in the history
#17 Fix PHP notice caused by uninitialized $i variable
  • Loading branch information
alexandermarston authored Oct 4, 2018
2 parents 359218a + c485c39 commit b427952
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vnstat.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function getVnstatData($path, $type, $interface)
$monthly = [];
$top10 = [];

$i = 0;
foreach ($vnstatDecoded['interfaces'][0]['traffic']['tops'] as $top) {
if (is_array($top)) {
++$i;
Expand All @@ -123,6 +124,7 @@ function getVnstatData($path, $type, $interface)
}
}

$i = 0;
foreach ($vnstatDecoded['interfaces'][0]['traffic']['days'] as $day) {
if (is_array($day)) {
++$i;
Expand All @@ -142,6 +144,7 @@ function getVnstatData($path, $type, $interface)
}
}

$i = 0;
foreach ($vnstatDecoded['interfaces'][0]['traffic']['hours'] as $hour) {
if (is_array($hour)) {
++$i;
Expand All @@ -161,6 +164,7 @@ function getVnstatData($path, $type, $interface)
}
}

$i = 0;
foreach ($vnstatDecoded['interfaces'][0]['traffic']['months'] as $month) {
if (is_array($month)) {
++$i;
Expand Down

0 comments on commit b427952

Please sign in to comment.