1. 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

Discussion in 'Resolved Bug Reports' started by lazy llama, Aug 30, 2012.

  1. lazy llama

    lazy llama Well-Known Member

    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:
    Just needs a length check before writing it to the database.
    Not an exciting bug, and only mods or admins will experience it.
     
    Vincent and Chris D like this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    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
    ),​
    <...>​
    )​
    );​
    }
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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).
     
    Chris D likes this.
  4. Mike

    Mike XenForo Developer Staff Member

    Fixed now.
     
    lazy llama and Slavik like this.

Share This Page