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 :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Return to the default flat view Create a new topic Submit Reply
Code fix for the fatal division by zero error if moderator uses "move selected" button [message #167809] Thu, 04 October 2012 21:18 Go to previous message
DPhan is currently offline  DPhan   United States
Messages: 9
Registered: September 2012
Location: San Jose, Calif
Karma:
Junior Member
add to buddy list
ignore all messages by this user
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
[Message index]
 
Read Message
Read Message
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: Thu Oct 19 18:07:14 EDT 2017

Total time taken to generate the page: 0.00660 seconds