• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Custom Warning: Title length limit not checked

lazy llama

Well-known member
#1
If you go to warn a user, select a Custom Warning and put more than 150 characters in the text box you get a server error:
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Data too long for column 'title' at row 1 - library/Zend/Db/Statement/Mysqli.php:214
Just needs a length check before writing it to the database.
Not an exciting bug, and only mods or admins will experience it.
 

Chris D

XenForo developer
Staff member
#2
I can confirm this.
Fix is as follows, in case anyone feels it important enough.

Add the code in red.

XenForo_DataWriter_Warning:

Code:
protected function _getFields()
{
return array(​
'xf_warning' => array(​
<...>​
'title' => array('type' => self::TYPE_STRING, 'required' => true,​
'requiredError' => 'please_enter_valid_title', 'maxLength' => 150
),​
<...>​
)​
);​
}
 

Jake Bunce

XenForo moderator
Staff member
#3
Confirmed here as well. The fix Chris posted is correct. Though technically you could get away with up to 255 characters. That field is a varchar(255).