Closed (fixed)
Project:
Fivestar
Version:
6.x-1.12
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2008 at 11:55 UTC
Updated:
26 Jan 2010 at 19:44 UTC
warning: Division by zero in /MY_PATH/sites/all/modules/fivestar/fivestar.module on line 1235.
I get this error when i edit the content type settings...
Installed 5.6 with fresh voting api and fivestar 1.11 beta3, jquery update
The voting widgets on /admin/settings/fivestar are not shown at all. only selects show up.
Comments
Comment #1
quicksketchI can't reproduce this issue. Perhaps it was corrected elsewhere or I need more information to reproduce. Are you using fivestar with CCK or is this just for the normal node voting?
Comment #2
mrgoltra commentedSame here. Everytime I edit any content type. I get the following error.
Using 5.7 and latest release 5.x-1.11-beta4 , voting API 5.x-1.5
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1250.
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1251.
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1250.
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1251.
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1250.
* warning: Division by zero in /hsphere/local/home/mysite.com/sites/all/modules/voting/fivestar/fivestar.module on line 1251.
Comment #3
quicksketchShoot, I updated my sandbox to 5.7 and matched my install to mrgoltra's, but I still can't see this problem. The mostly likely culprit looks like the 'fivestar_stars_[nodetype]' variable is set to 0. I'm not really sure how this could happen though.
To verify this is the case in beta4, could one of you try out changing line 809 to
'stars' => 5,and see if the warning goes away?. I can't figure out why this wouldn't be set to the default.Comment #4
2c commentedquicksketch, I recently updated fivestar to version 5.x.1.11 and received the errors reported in this issue. I tried out your suggestion but it hasn't had any effect on the errors.
Comment #5
Bo Kleve commentedI have had the same problem with my installation.
The problem is something wrong with line 1317 that reads:
$numeric_rating = $rating/(100/$stars);. Evidently $stars somehow is set to 0 somewhere before theme_fivestar_static is called?Changing the offending line to
$numeric_rating = $rating * $stars / 100;takes away any possibility of a divide by zero.If you have the same problem on other lines, I suggest changing them accordingly. And for ease of returning to the original code, should something go wrong, just comment out the problematic line and add the changed line.
Comment #6
ken69 commentedwarning: Division by zero in .... fivestar/fivestar_field.inc on line 284.
284 line is:
return round(100/$element['#item']['rating'], 1)/$element['#field']['stars'];
I have % not stars and i use CCK.
Regards
Comment #7
quicksketchTo simply ensure that we never get a division by 0 error, I've added the following code.
Please try out the latest version of Fivestar and reopen if this issue is not fixed.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
aric koenig commentedIn which file and on what line did you place this code?