Support » Plugin: WP-Polls » [Plugin: WP-Polls] Math calculation error – PHP warning!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ok I think I have found the error:
    The error was in the following code –

    // Make Sure That Total Percentage Is 100% By Adding A Buffer To The Last Poll Answer
    if($poll_multiple_ans == 0) {
     $poll_answer_percentage_array[] = $poll_answer_percentage;
     if(sizeof($poll_answer_percentage_array) == sizeof($poll_answers)) {
       $percentage_error_buffer = 100 - array_sum($poll_answer_percentage_array);
       $poll_answer_percentage = $poll_answer_percentage + $percentage_error_buffer;
       if($poll_answer_percentage < 0) {
        $poll_answer_percentage = 0;

    Actually if you allow user to select more than one answer, then only above code should execute and for that to check ($poll_multiple_ans == 1). On changing this now works fine but still gives error for multiple vote selection case and the error is showing 1% for 0 votes.

    Thanks for directing me over to this thread. I tried ($poll_multiple_ans == 1) and the only change I see is that instead of the 8 Votes for No being 0% it is now 27%. But the Yes votes are still coming out to 103%. Any ideas??? Thank you again for any help.

    The line on that error is wrong. I’m now trying to fix some of the issues on github.

    I change the line:
    $poll_answer_percentage = round((($poll_answer_votes/$poll_question_totalvoters)*100));
    $poll_answer_percentage = round((($poll_answer_votes/$poll_question_totalvotes)*100));

    Thanks @marko Heijnen

    thank you Marko Heijnen this really helped.
    but I think the error is not reported the total number of voters

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP-Polls] Math calculation error – PHP warning!’ is closed to new replies.