How to prevent division by zero error [message #37491] |
Tue, 29 May 2007 17:34 |
derek
Messages: 21 Registered: May 2007
Karma: 0
|
Junior Member |
|
|
Hello,
I don't think this can be a bug, hence my posting here - hope this is OK. I've searched and seen similar divide by zero problems but I can't see this particular one, and I can't relate the answers I've seen to my specific problem.
Having upgraded to 2.7.6 a few hours ago, all seems OK except when adding a new topic or posting a reply, when users get this message:
Warning: Division by zero in [path]/docs/forum/theme/default/post.php on line 2270
Have I set something to zero that I shouldn't have?
Thanks for any advice...
Derek
|
|
|
|
|
|
Re: How to prevent division by zero error [message #37515 is a reply to message #37503] |
Thu, 31 May 2007 10:39 |
derek
Messages: 21 Registered: May 2007
Karma: 0
|
Junior Member |
|
|
Thank you very much. I changed this to a number higher than zero (I was trying not to show any icons, but obviously this is not how to achieve that), went back to the forum and was able to post without the divide by zero error.
However, and I can't say whether this is connected or not, now when users try to log in they get this message:
Quote: | Warning: pg_query() [function.pg-query]: Query failed: ERROR: Argument of OR must be type boolean, not type integer in [path]/docs/forum/index.php on line 95
Fatal error: SQL Error has occurred, please contact the administrator of the forum and have them review the forum's SQL query log in [path]/FUDforum/include/core.inc on line 188
|
The sql_errors file has this (I'm using postgres):
Quote: | ?1429 ?1180600719?([path]/docs/forum/index.php:95<br />
[path]/docs/forum/index.php:89<br />
[path]/docs/forum/theme/default/index.php:151<br />
[path]/docs/forum/index.php:1219<br />
) : ERROR: Argument of OR must be type boolean, not type integer<br />
Query: SELECT
m.subject, m.id, m.post_stamp,
u.id, u.alias,
f.cat_id, f.forum_icon, f.id, f.last_post_id, f.moderators, f.name, f.descr, f.post_count, f.thread_count,
fr.last_view, mo.id, COALESCE(g2.group_cache_opt, g1.group_cache_opt) AS group_cache_opt,
c.cat_opt & 4
FROM fud25_fc_view v
INNER JOIN fud25_cat c ON c.id=v.c
INNER JOIN fud25_forum f ON f.id=v.f
INNER JOIN fud25_group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id
LEFT JOIN fud25_msg m ON f.last_post_id=m.id
LEFT JOIN fud25_users u ON u.id=m.poster_id LEFT JOIN fud25_forum_read fr ON fr.forum_id=f.id AND fr.user_id=9 LEFT JOIN fud25_mod mo ON mo.user_id=9 AND mo.forum_id=f.id LEFT JOIN fud25_group_cache g2 ON g2.user_id=9 AND g2.resource_id=f.id WHERE (mo.id IS NOT NULL OR (COALESCE(g2.group_cache_opt, g1.group_cache_opt)) & 1)>0 ORDER BY v.id<br />
_GET: array (
'S' => 'd3a34e44ffaf72b0bd2b6a6a77aaabe0',
'SQ' => '727735018baf0ff543f3998f0c220d62',
)<br />
Server Version: <br />
|
I see the problem reported here:
http://fudforum.org/forum/index.php?t=msg&goto=33770&&srch=Quer y+failed#msg_33770
but does this mean that the wrong version of index.php is being distrubuted with the upgrade? Can you confirm what/where the final version is, so I can copy it over the one I installed (or do I have to edit it to add in the corrected lines?)
Thanks again,
Derek
|
|
|
|
|
Re: How to prevent division by zero error [message #37546 is a reply to message #37527] |
Sun, 03 June 2007 15:09 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You need to make the replacement inside index.php.t and then rebuild the theme via the theme manager. That will regenerate index.php page.
FUDforum Core Developer
|
|
|
|
|
|
|