FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Division by Zero in Compact Message
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Division by Zero in Compact Message [message #29762] Sat, 14 January 2006 15:33 Go to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
Looks like there is a problem with Compact Message feature.
I ran it and that's the output:
Disabling the forum for the duration of maintenance run

Please wait while forum is being compacted.
This may take a while depending on the size of your forum.
Compacting normal messages...
10% done
ETA: 0 seconds
20% done
ETA: 0 seconds
30% done
ETA: 0 seconds
40% done
ETA: 0 seconds
50% done
ETA: 0 seconds
60% done
ETA: 0 seconds
70% done
ETA: 0 seconds
80% done
ETA: 0 seconds
100% Done
Compacting private messages...

Warning: Division by zero in /home/xxx/forum/adm/compact.php on line 88

Warning: Division by zero in /home/xxx/forum/adm/compact.php on line 89
0% done
ETA: 0 seconds
100% Done
Done in 0,00 minutes

Re-enabling the forum.


Probabily this is because I don't have any Private Message (Forum just opened).
Re: Division by Zero in Compact Message [message #29765 is a reply to message #29762] Sat, 14 January 2006 16:29 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
What version of the forum?

FUDforum Core Developer
Re: Division by Zero in Compact Message [message #29772 is a reply to message #29762] Sat, 14 January 2006 17:11 Go to previous messageGo to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
Message refers to both 2.7.3 and 2.7.4 (I did the upgrade half an hour ago)
Re: Division by Zero in Compact Message [message #29776 is a reply to message #29772] Sat, 14 January 2006 18:02 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Yup, that's the case.
This patch should fix it.
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=7519


FUDforum Core Developer
Re: Division by Zero in Compact Message [message #29780 is a reply to message #29762] Sat, 14 January 2006 23:40 Go to previous messageGo to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
Sorry, but it didn't work completely.

Now I see that ETA is calculated on other steps, but still I got that error.
I looked inside the code and found that the cause is not directly the absence of private messages in the board.

The ETA function is the thing that messes up everything.
I got the error on its 4th line, where the division is. Maybe because PMs are none, but I couldn't deeply analyze the code
<?php
function eta_calc($start$pos$pc)
{
        
$cur time();
        
$prg $pos $pc;
        
$eta = ($cur $start) / $prg * (10 $prg);
        if (
$eta 60) {
                echo (
$prg 10) . "% done<br>\nETA: ".sprintf('%.2f'$eta/60)." minutes<br>\n";
        } else {
                echo (
$prg 10) . "% done<br>\nETA: " $eta " seconds<br>\n";
        }
}
?>

If $pc is zero, theorycally $prg is infinite and $eta is a finite number (equal to $cur-$start).)
Re: Division by Zero in Compact Message [message #29791 is a reply to message #29780] Mon, 16 January 2006 14:42 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
With the patch I've posted earlier the entire private message compacting block is skipped in the event there are no private messages. Meaning that the eta_calc() function wouldn't even be called if there are no private messages.

FUDforum Core Developer
Re: Division by Zero in Compact Message [message #29794 is a reply to message #29762] Mon, 16 January 2006 15:44 Go to previous messageGo to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
Don't know what to say... I'll try to upload the file again...
Re: Division by Zero in Compact Message [message #29795 is a reply to message #29762] Mon, 16 January 2006 15:51 Go to previous messageGo to next message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
Sorry but it still doesn't work...

I clicked on th patch link, then on the
install/www_root/adm/compact.php link and right-clicked and Saved "1.61" (Mozilla Firefox). I went in the Admin area, File Manager, adm directory. I deleted the old compact.php file, uploaded the new one, CHMOD 0755 (my server requires it) and I still got that error, as follows:

Disabling the forum for the duration of maintenance run

Please wait while forum is being compacted.
This may take a while depending on the size of your forum.
Compacting normal messages...
10% done
ETA: 0 seconds
20% done
ETA: 0 seconds
30% done
ETA: 0 seconds
40% done
ETA: 0 seconds
50% done
ETA: 0 seconds
60% done
ETA: 0 seconds
70% done
ETA: 0 seconds
80% done
ETA: 0 seconds
90% done
ETA: 0 seconds
100% Done
Compacting private messages...

Warning: Division by zero in /home/www/kamelot/forum/adm/compact.php on line 88

Warning: Division by zero in /home/www/kamelot/forum/adm/compact.php on line 89
0% done
ETA: 0 seconds

Warning: Division by zero in /home/www/kamelot/forum/adm/compact.php on line 88

Warning: Division by zero in /home/www/kamelot/forum/adm/compact.php on line 89
0% done
ETA: 0 seconds
100% Done
Done in 0,00 minutes

Re-enabling the forum.


When I said there are no private messages in the Forum, I was unfortunately wrong. The first user already started to chit-chat Smile, because there are entries in the Forum_pmsg table (I suppose that's the PM table).

So maybe this error is caused by something else...

[Updated on: Mon, 16 January 2006 15:53]

Report message to a moderator

Re: Division by Zero in Compact Message [message #29796 is a reply to message #29795] Mon, 16 January 2006 16:21 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
ok, the fact there ARE messages is a clue Wink
Try this version
http://cvs.prohost.org/c/index.cgi/FUDforum/getfile/install/www_root/adm/co mpact.php?v=1.62


FUDforum Core Developer
Re: Division by Zero in Compact Message [message #29797 is a reply to message #29762] Mon, 16 January 2006 17:11 Go to previous message
djechelon is currently offline  djechelon   Italy
Messages: 46
Registered: July 2005
Karma: 0
Member
It worked! Laughing
I can see ETAs are no zero like before!

FUDforum RuLeZ!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Error : Invalid group id when Mass Emailing
Next Topic: Query failed
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Jun 01 23:59:08 GMT 2024

Total time taken to generate the page: 0.04098 seconds