Hello, using latest drigg express way from 9th september (downloaded a couple of days ago) I've setup autovoting, but keep receiving this php error, division by zero:
Division by zero in /home/mydomainname.com/sites/all/modules/drigg/drigg_autovote/drigg_autovote.module on line 162.
Then in the next watchdog entry there is 0 votes:
Stories in queue voted by deciders: 0, Votes real: 0
Seconds since last autovoting: 172892, Voters deciders plus real: 0, Votes to assign per hour: 2, Votes per hour total: 0, Votes to assign: 0, remainder (votes): 0, reminder (seconds): (0 votes per seconds, 0 votes per minute), 172892 seconds passed since last autovoting
So I guess something is trying to divide by the number of deciders or real votes..
I have set up deciders and voters users, but I haven't voted with a decider user, so indeed there's no stories in queue voted by deciders, but there shouldn't be a php error of division by zero, the case should be handled by your script in a correct way.
Please tell me if you need more information about my setup or how to reproduce the bug.
Comments
Comment #1
mercmobily commentedHi,
This autovoting thing _really_ is black magic. Even though the code has _no_ optimisation at all, it always takes me a _long_ time to figure it out...
In /home/mydomainname.com/sites/all/modules/drigg/drigg_autovote/drigg_autovote.module on line 162, please change:
Into:
And let me know if it fixes the problem. If it does, I will commit it.
Bye!
Merc.
Comment #2
mercmobily commentedHi,
Wooops... please watch out, the new code should be:
Comment #3
davidmosen commentedHi,
Hey Merc, I'm not familiar with that code, but I think it should be the other way round: you are dividing by it when it IS zero! ;)
David
Comment #4
mercmobily commentedHi,
Oh geeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!!!
Humm... err.. yah :-)
Merc.
Comment #5
mercmobily commentedHi,
So...
Merc.
Comment #6
alliax commentedHi, thank you for your patch, I've applied it and the php error has not reoccured after the cron update and before the "Stories in queue voted by deciders: 0, Votes real: 0" notification.
Comment #7
mercmobily commentedHi,
OK. Can you please test it if it also works in "normal" conditions?
Merc.
Comment #8
alliax commentedI don't see what you mean by "normal" conditions. I've just installed Drigg, setup 50 false users, made 3 deciders and the rest voters, then I tested it by voting with a decider, it worked, the scoop has been promoted. And then after the php error occured.
Now after applying the patch there's no more php error. So your patch works in this matter.
But I have to admit that the exact way in which auto voting works is still quite foreign to me, I wish I could setup a system which would vote for stories in the upcoming queue at random without me having to hand select the scoops by logguing as a decider and voting for each one, but I guess you haven't done this scenario because you don't see the point in having a totally false digg, you just want an autovoting to help start a real digg. Well everyone's different. :-)
Comment #9
mercmobily commentedHi,
You are exactly right :-D
OK, fixed in CVS.
Merc.
Comment #10
wwwoliondorcom commentedThanks for this one !
Comment #11
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #12
santhosh s r commentedI am getting
Warning: Division by zero in C:\wamp\www\cleantype\wipreport.php on line 222
And in line 222 coding is
else
{
echo "
";
}
plz update anybody regarding these ASAP
Comment #13
santhosh s r commentedif($count3[$k]==0 AND $count2[$k]!=0)
{
echo "
";
}
else if($count3[$k]!=0 AND $count2[$k]!=0)
{
echo "
";
}
else if($count3[$k]!=0 AND $count2[$k]==0)
{
echo "
";
}
else
{
echo "
";
}
Comment #14
alliax commentedPlease santhosh s r find a loaded gun, look inside the barrel and press the trigger, your garbage has nothing to do with drupal or drigg. Not mentionning you don't have any division in your "code" :-)