Division by zero error
seutje - October 2, 2009 - 13:52
| Project: | Chart API |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
concerning function _chart_adjust_resolution($chart_id, &$data, $max_value = NULL)
if $max[$chart_id] is 0, a division by zero error is thrown
attached patch solves this by changing this
<?php
if ($max[$chart_id] > $resoluton){
$divider = round($max[$chart_id] / $resoluton, 1);
}
else {
$multiplier = round($resoluton / $max[$chart_id], 1);
}
?>into this
<?php
if ($max[$chart_id] > $resoluton){
$divider = round($max[$chart_id] / $resoluton, 1);
}
elseif ($max[$chart_id] != 0) {
$multiplier = round($resoluton / $max[$chart_id], 1);
}
?>should apply to HEAD
| Attachment | Size |
|---|---|
| chart-division-by-zero.patch | 554 bytes |

#1
By the way, I got this error in combination with the google analytics API module, not sure if this is chart API's fault for not catching it, or google analytics API's fault for calling a function with improper values
-> #551146: Warning error when viewing nodes