Bug in SMF 1.1.4 Re: post counts

Started by marestare, March 09, 2008, 07:52:59 AM

Previous topic - Next topic

marestare

Hello everyone,

I have just encountered an interesting bug.

I have a moderator on my forum who doesn't post much. He does, however, move a lot of topics around, leaving redirection topics for a while, then later removing them.

We have encountered a situation now where whenever he or ANY mod or admin tries to remove one of these redirection topics, we get the following error:

QuoteOut of range value adjusted for column 'posts' at row 1
File: C:\Inetpub\wwwroot\forum\Sources\Subs.php
Line: 634

I looked at his profile and he has zero posts, even though he has made posts in the past that have not been deleted. Here's what I believe is happening:

When someone moves a topic, and leaves a redirection topic behind, that topic DOES NOT add to the person's post count. However when he or another mod deletes or removes the redirection topic, it decrements his post count. Because of this uneven math, the person's post count could eventually reach zero, at which point the error will then occur.

This error should only happen with moderators or anyone who has permission to move topics. There are two workarounds that seem to work:

1. Adjust the moderator's post count back above zero, or,

2. The topic can be MOVED to the recycle bin, which does not affect the post count. However, I am assuming that if the recycle bin were cleaned out, the error would occur at that point.

jossanaijr

Did you try "Recount all forum totals and statistics."?

jerm

We weren't able to reproduce this error.

Mods installed?
Theme?

Can you try doing the same thing on your forum but with another user. Create a dummy account for example.

marestare

I just did it again to verify. It's quite simple really. Here are the steps.

Create a user.

Give them moderator privileges (ability to move a topic.)

Create a test topic, USING ANOTHER USER, so the test user's post count remains at zero.

Have the test user move the topic, creating a redirection topic. (Note that the test user's post count is still zero--he did not get credit for the redirection post.)

Have another moderator try to delete the redirection topic. The error presents.

To verify that it is post count-related, edit the test users account and add one post to his profile.

Once again from the other user's account, delete the redirection topic. This time it will be successful.

Jade Elizabeth

Quote from: marestare on March 09, 2008, 09:31:23 PM
I just did it again to verify. It's quite simple really. Here are the steps.

Create a user.

Give them moderator privileges (ability to move a topic.)

Create a test topic, USING ANOTHER USER, so the test user's post count remains at zero.

Have the test user move the topic, creating a redirection topic. (Note that the test user's post count is still zero--he did not get credit for the redirection post.)

Have another moderator try to delete the redirection topic. The error presents.

To verify that it is post count-related, edit the test users account and add one post to his profile.

Once again from the other user's account, delete the redirection topic. This time it will be successful.

I did this before Jerm posted. I encountered no such errors. I did it several times to check too. I think it is something you have installed, because it does not happen on a clean install.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

marestare

I have no mods installed.

I have a custom theme, but it is all style-related. There are no coding changes except for headers and an iframe on index.php.

My theme is based on the default theme that installs with SMF.

As far as tweaking configuration settings...now that's another story. If I can identify any setting(s) I changed that cause the error, I will post back.

Jade Elizabeth

Quote from: marestare on March 10, 2008, 01:41:16 AM
I have no mods installed.

I have a custom theme, but it is all style-related. There are no coding changes except for headers and an iframe on index.php.

My theme is based on the default theme that installs with SMF.

As far as tweaking configuration settings...now that's another story. If I can identify any setting(s) I changed that cause the error, I will post back.

Did you edit the file with the error message?

QuoteOut of range value adjusted for column 'posts' at row 1
File: C:\Inetpub\wwwroot\forum\Sources\Subs.php
Line: 634

What's at line 634 of the subs.php file (show us 5 lines above and below too please)? Did anything you install edit this file?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

marestare

The version for subs.php is 1.1.4 (double checked.) Nothing modified the file, as I have no mods installed, and I haven't touched it.

Here is the relevant code:

Quoteforeach ($data as $var => $val)
   {
      $setString .= "
         $var = $val,";
   }

   db_query("
      UPDATE {$db_prefix}members
      SET" . substr($setString, 0, -1) . '
line 634=>      WHERE ' . $condition, __FILE__, __LINE__);

   updateStats('postgroups', $condition, array_keys($data));

   // Clear any caching?
   if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2 && !empty($members))
   {
      if (!is_array($members))
         $members = array($members);

Jade Elizabeth

If you have no modifications installed at all, and no code edits, I think that perhaps you should redownload the file and reupload it...If that doesn't help, it must be another file I suppose, or server side. That error, and those symptoms do not happen on a fresh SMF install.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

marestare

Let me ask this then. On the fresh install, are redirection topics credited to the user's post count, or not?

Jade Elizabeth

Quote from: marestare on March 11, 2008, 12:32:54 AM
Let me ask this then. On the fresh install, are redirection topics credited to the user's post count, or not?

Not on mine lol
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

marestare

OK then. :) That means that my "bad behavior" is that the topic mover is getting deducted 1 post when someone deletes the redirection topic.

Jade Elizabeth

It could be a bad file, if you have done no edits to the source files, reuploading may help :).
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Advertisement: