I don't know why this is happening, but when I edit one of my content types, I see the following warnings:
warning: Division by zero in sites/all/modules/fivestar/fivestar.module on line 1427.
warning: Division by zero in sites/all/modules/fivestar/fivestar.module on line 1428
The relevant code is:
...
for ($i = 0; $i <= $element['#stars']; $i++) {
$this_value = ceil($i * 100/$element['#stars']);
$next_value = ceil(($i+1) * 100/$element['#stars']);
...
I do not have fivestar enabled for this content type.
Any ideas?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | fivestar-327609.patch | 680 bytes | stormsweeper |
| #5 | fivestar-327609-d5.patch | 675 bytes | stormsweeper |
| #4 | fivestar-327609.patch | 678 bytes | stormsweeper |
Comments
Comment #1
dleeward commentedI'm having the same problem when I use the Five Star CCK field in a view set as a percentage. I noticed that it has been fixed in 6.x. Will it be fixed in 5.x?
Comment #2
ogi commentedNot fixed in 6.x-1.13. I have a content type (CCK) and the page Edit for that content type shows the following warning twice. Fivestar is not configured in any way, it's just enabled.
warning: Division by zero in /home/ogi/public_html/acquia/modules/acquia/fivestar/fivestar.module on line 1472.It's worth noting that I'm using PostgreSQL.
Comment #3
stormsweeper commentedI am also getting this in the latest 6.x release - it doesn't seem to break anything, it's just annoying. I'm using prior 5.x versions without the error. I'm also using Postgres, but I will look at the code before I say if that's an issue.
Comment #4
stormsweeper commentedThe error points to fivestar_expand($element), namely this for loop:
I presume this is being called by the "preview" widget when editing a type. I added this in just before it:
A patch against 6.x-1.13 is attached.
Comment #5
stormsweeper commentedAnd here's an untested patch against 5.x-1.13
Comment #6
quicksketchPlease check the latest development version of Fivestar, this might have already been fixed. The patch needs to be rolled against the latest version regardless.
Comment #7
stormsweeper commentedComment #8
stormsweeper commentedWeird, my reply was lost. That patch is against DRUPAL-6--1, I don't have a test 5.x site right now to test out a DRUPAL-5 patch, but the DRUPAL-6--1 branch definitely still has the reported issue, and it would appear the same will be true for DRUPAL-5, looking at the code.
Comment #9
ebeyrent commentedI'll check out the D5 code and see if it fixes my issue.
Comment #10
Jn3 commentedProblem still there as of latest version.
warning: Division by zero in .../sites/all/modules/fivestar/fivestar_field.inc on line 291.
Comment #11
quicksketchJn3, the latest version is the development version, which contains 7 months of fixes that aren't in the 1.13 version. A new release of Fivestar should be coming soon, but in the mean time, I'd appreciate if you could try out the development version and see if this has been fixed there.
Comment #12
quicksketchPlease reopen if this problem can be reproduced in the 1.15 version.