Current time: 05-24-2012, 02:03 PM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[F] Error adding Warn Points.
03-01-2009, 09:38 AM (This post was last modified: 03-01-2009 09:38 AM by Ryu.Hack.)
Post: #1
[F] Error adding Warn Points.
Hello, I found this error adding Warn Points:

PHP Code:
SQL Error:
    
1364 Field 'revokereason' doesn't have a default value
Query:
    INSERT INTO mybb_warnings (`uid`,`tid`,`pid`,`title`,`points`,`dateline`,`issuedby`,`expires`,`expire​d`,`notes`) VALUES ('
2','3','20','','10','1235899865','1','1236504665','0','Demasiado flood xd') 

And the system dont add the Warning Points. What I do need for resolve this problem?

Thanks in Advanced.
Find all posts by this user
03-01-2009, 02:14 PM (This post was last modified: 03-01-2009 03:38 PM by dvb.)
Post: #2
RE: Error adding Warn Points.
When I'm trying to export the structure of "warnings" I'm receiving this:
Code:
CREATE TABLE IF NOT EXISTS `prefix_warnings` (
  `wid` int(10) unsigned NOT NULL auto_increment,
  `uid` int(10) unsigned NOT NULL default '0',
  `tid` int(10) unsigned NOT NULL default '0',
  `pid` int(10) unsigned NOT NULL default '0',
  `title` varchar(120) NOT NULL default '',
  `points` int(10) unsigned NOT NULL default '0',
  `dateline` bigint(30) NOT NULL default '0',
  `issuedby` int(10) unsigned NOT NULL default '0',
  `expires` bigint(30) NOT NULL default '0',
  `expired` int(1) NOT NULL default '0',
  `daterevoked` bigint(30) NOT NULL default '0',
  `revokedby` int(10) unsigned NOT NULL default '0',
  `revokereason` text NOT NULL,
  `notes` text NOT NULL,
  PRIMARY KEY  (`wid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;
So as you can see the fields `revokereason` & `notes` really doesn't have a default value (while still "NOT NULL") but I can't reproduce that...
My test doesn't show any error and the points given.

----

After some more testing I've found that this is related to the 'strict mode', in my board I'm receiving just a warning from mysql (I'm not in 'strict mode')

The code that cause this error is:
warnings.php, lines 235-247 Wrote:
PHP Code:
        $new_warning = array(
            
"uid" => $user['uid'],
            
"tid" => intval($warning_type['tid']),
            
"pid" => intval($post['pid']),
            
"title" => $db->escape_string($warning_title),
            
"points" => intval($points),
            
"dateline" => TIME_NOW,
            
"issuedby" => $mybb->user['uid'],
            
"expires" => $warning_expires,
            
"expired" => 0,
            
"notes" => $db->escape_string($mybb->input['notes'])
        );
        
$db->insert_query("warnings"$new_warning); 

Possible fix, replace with:
PHP Code:
        $new_warning = array(
            
"uid" => $user['uid'],
            
"tid" => intval($warning_type['tid']),
            
"pid" => intval($post['pid']),
            
"title" => $db->escape_string($warning_title),
            
"points" => intval($points),
            
"dateline" => TIME_NOW,
            
"issuedby" => $mybb->user['uid'],
            
"expires" => $warning_expires,
            
"expired" => 0,
            
"revokereason" => '',
            
"notes" => $db->escape_string($mybb->input['notes'])
        );
        
$db->insert_query("warnings"$new_warning); 
I've just added:
PHP Code:
"revokereason" => ''

----

A note to the developers!
When you're fixing this bug, don't forget to also fix the installer with a default value to prevent new similar bugs

Creativity is a drug I cannot live without.
[Image: 1]Support PM will be ignored
Visit this user's website Find all posts by this user
03-01-2009, 03:22 PM
Post: #3
RE: Error adding Warn Points.
Yeah! The bug is fixed with this replace. Thanks ^^
Find all posts by this user
03-04-2009, 01:47 AM
Post: #4
[F] Error adding Warn Points.
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group
Visit this user's website Find all posts by this user
04-13-2009, 05:08 AM
Post: #5
RE: [F] Error adding Warn Points.
I tried this fix and it still doesn't work for me. Can someone please attach their warnings file so that I can upload it?

Thanks
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication