Skip to content

Commit

Permalink
When viewing graph data, non-numeric values may appear (#4461)
Browse files Browse the repository at this point in the history
Closes #4461
  • Loading branch information
netniV committed Nov 14, 2021
1 parent d1c1380 commit 9b9754e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Cacti CHANGELOG
-issue#4451: Remote pollers may not get settings when system-wide polling is turn off
-issue#4455: When updating poller name, matches may be too wide in scope
-issue#4458: MIB Cache column check causes poller crash under PHP 8.x
-issue#4461: When viewing graph data, non-numeric values may appear

1.2.19
-security#4356: Further fixes for grave character security protection
Expand Down
15 changes: 10 additions & 5 deletions graph_xport.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,18 @@
print "<tr><td class='left'>" . date('Y-m-d H:i:s', (isset($row['timestamp']) ? $row['timestamp'] : $xport_array['meta']['start'] + $j*$xport_array['meta']['step'])) . "</td>";

for ($i = 1; $i <= $xport_array['meta']['columns']; $i++) {
if ($row['col' . $i] > 1) {
print "<td class='right'>" . trim(number_format_i18n(round($row['col' . $i],3),2,$graph_info['base_value'])) . '</td>';
} elseif($row['col' . $i] == 0) {
print "<td class='right'>-</td>";
$row_data = floatval($row['col'.$i]);
if ($row_data > 1) {
$row_data = trim(number_format_i18n(round($row_data,3),2,$graph_info['base_value']));
} elseif($row_data == 0) {
$row_data = '-';
if (!is_numeric($row['col'.$i])) {
$row_data .= '(unexpected: ' . $row['col'.$i].')';
}
} else {
print "<td class='right'>" . round($row['col' . $i],4) . '</td>';
$row_data = trim(number_format_i18n(round($row_data,5),4));
}
print "<td class='right'>$row_data</td>";
}

print "</tr>\n";
Expand Down

0 comments on commit 9b9754e

Please sign in to comment.