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

Home » FUDforum Development » Plugins and Code Hacks » Code fix for the fatal division by zero error if moderator uses "move selected" button
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Code fix for the fatal division by zero error if moderator uses "move selected" button [message #167809] Fri, 05 October 2012 01:18 Go to next message
DPhan is currently offline  DPhan   United States
Messages: 9
Registered: September 2012
Location: San Jose, Calif
Karma: 0
Junior Member
I've described the problem in the Bug Report forum:

http://fudforum.org/forum/index.php?t=msg&th=120609&start=0&

Here's the code fix:

diff -u mmd.php.t mmd.php.t-orig

--- mmd.php.t	2012-10-04 18:06:03.483544340 -0700
+++ mmd.php.t-orig	2012-10-04 17:55:04.595502461 -0700
@@ -146,7 +146,7 @@
 				LEFT JOIN {SQL_TABLE_PREFIX}mod m ON m.user_id='._uid.' AND m.forum_id=f.id
 				INNER JOIN {SQL_TABLE_PREFIX}group_cache g1 ON g1.user_id=2147483647 AND g1.resource_id=f.id
 				LEFT JOIN {SQL_TABLE_PREFIX}group_cache g2 ON g2.user_id='._uid.' AND g2.resource_id=f.id
-				WHERE c.id!=0 AND f.id!='. $perms[0] . ($is_a ? '' : ' AND (CASE WHEN m.user_id IS NOT NULL OR '. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 1)  . ' > 0 THEN 1 ELSE 0 END)=1') .'
+				WHERE c.id!=0 AND f.id!='. $perms[0] . ($is_a ? '' : ' AND (CASE WHEN m.user_id IS NOT NULL OR '. q_bitand('COALESCE(g2.group_cache_opt, g1.group_cache_opt)', 1) /' > 0 THEN 1 ELSE 0 END)=1') .'
 				ORDER BY v.id');
 
 		require $FORUM_SETTINGS_PATH .'cat_cache.inc';



As can be seen in the original code, there is a slash character where a dot is intended. This led the PHP interpreter to issue a division by zero warning and the subsequent fatal SQL error.

I'll commit the code change to SourceForge upon approval.

Dan
Re: Code fix for the fatal division by zero error if moderator uses "move selected" button [message #167810 is a reply to message #167809] Fri, 05 October 2012 15:38 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Looks good to me.
Please commit!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Newbie question: where to check in bug fix on sourceforge?
Next Topic: Using mailman, fud, /etc/aliases, maillist.php, and custom filter scripts
Goto Forum:
  

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

Current Time: Fri Nov 01 00:05:44 GMT 2024

Total time taken to generate the page: 0.02473 seconds