SMF 2.0.2 - Field 'spam' doesn't have a default value

Started by sdietz, April 23, 2012, 06:58:15 PM

Previous topic - Next topic

sdietz

Hey Everyone,

A little background.. I recently upgraded to 2.0.2. After the upgrade we starting getting hammered with fake (spam) accounts wanting to register so not sure how closely related it is to this error.

I recently removed all packages and did a fresh upgrade to 2.0.2. There are we are having is while trying to respond to a post. The full error is:

Field 'spam' doesn't have a default value
File: D:\web\aeoutdoors\forum\Sources\Subs-Post.php
Line: 1824

Here is lines 1808 thru 1825 of my Subs-post.php

   $new_topic = empty($topicOptions['id']);

   // Insert the post.
   $smcFunc['db_insert']('',
      '{db_prefix}messages',
      array(
         'id_board' => 'int', 'id_topic' => 'int', 'id_member' => 'int', 'subject' => 'string-255', 'body' => (!empty($modSettings['max_messageLength']) && $modSettings['max_messageLength'] > 65534 ? 'string-' . $modSettings['max_messageLength'] : 'string-65534'),
         'poster_name' => 'string-255', 'poster_email' => 'string-255', 'poster_time' => 'int', 'poster_ip' => 'string-255',
         'smileys_enabled' => 'int', 'modified_name' => 'string', 'icon' => 'string-16', 'approved' => 'int',
      ),
      array(
         $topicOptions['board'], $topicOptions['id'], $posterOptions['id'], $msgOptions['subject'], $msgOptions['body'],
         $posterOptions['name'], $posterOptions['email'], time(), $posterOptions['ip'],
         $msgOptions['smileys_enabled'] ? 1 : 0, '', $msgOptions['icon'], $msgOptions['approved'],
      ),
      array('id_msg')
   );
   $msgOptions['id'] = $smcFunc['db_insert_id']('{db_prefix}messages', 'id_msg');


Line 1824 doesn't have any value named SPAM.

Any ideas?

Thanks!

MrPhil

Perhaps a mod that used to be installed added a field 'spam' to the messages table. Use phpMyAdmin to examine the table and see if there is a 'spam' field in there. If so, it sounds like you would have to add the field to the first array() (defining the fields) and a value of some sort to the second array() (listing values). Alternatively, you could use phpMyAdmin to delete the spam field from the table, but take a backup first! If all the PHP code was refreshed, there should be no references anyway to the spam field.

sdietz

BINGO!

I have access to MySQL so I logged into that. First I did a complete backup, then examined the smf_messages table. As you suspected there was a SPAM field in there. After removal of that, we were able to post again.

Thanks!!!

sdietz

Just in case anyone else runs into this issue, I also had to remove the SPAM field from the smf_topics table.

Advertisement: