When I'm trying to export the structure of "warnings" I'm receiving this:
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: $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:
$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:
"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