Hi,
i have a problem with your views_cloud Modul Vers. 6.x-1.1 ... can you help me..?
My System Environment
Shared Hosting
Drupal: 6.15
MySQL database: 5.0.81
PHP: 5.2.12
PHP register globals: Disabled
Problem:
Error: Division by zero in /homepages/d615/sites/all/modules/views_cloud/views_cloud.module on line 152.
Code:
if ($algorithm == 'linear') {
$range = ($sizes - 1) / ($max - $min);
$value = ($value - $min) * $range;
return (intval($value + 1));
}
else {
$value = log($value == 0 ? ++$value : $value);
$min = log($min == 0 ? ++$min : $min);
$max = log($max);
$range = ($sizes - 1) / ($max - $min); // here is the problem => this is the Line 152
$value = ($value - $min) * $range;
return (intval($value + 1));
}
PS: I have the other 2 patches from the issues queue integrated but my error is dont go away....
Thank you for your Help & for your Mdule.
Best Regards from Munich
Attila
Comments
Comment #1
quicksketchThis problem should be impossible to encounter after #507376: Support for logarithmic mapping was included. Assuming this is the line that you get division by zero on:
It should now never be executed because just a few lines above it there is a check to prevent division by zero:
Since there haven't been any confirming reports, I'm assuming that this has already been corrected. Try using the latest stable version of the module.
Comment #2
henrijs.seso commentedStill a problem in latest stable, looks like check is ineffective because after log() both $min and $max is 0. Needs patch.
Comment #3
quicksketchHow is that not solved already by this conditional?
If $min and $max are both 0, you'll never get to the division at all.
Comment #4
henrijs.seso commentedthey are not 0 before log(). Sorry I cannot explain more, but dsm() told me that before one was 1 and other was 0, so they are not equal and after log() they both are 0. Im not that good with math and php :)
Comment #5
mthiner commentedI'm experiencing the same error (Error: Division by zero in .../sites/all/modules/views_cloud/views_cloud.module). I have the most recent release. Please advise.