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

XF 1.5 Editing a Smilie

silence

Well-known member
#1
When editing a smilie, I get this error:

Code:
Undefined index: title

    XenForo_Application::handlePhpError() in XenForo/Model/Smilie.php at line 342
    XenForo_Model_Smilie->getSmilieCategoryOptions() in XenForo/ControllerAdmin/Smilie.php at line 71
    XenForo_ControllerAdmin_Smilie->actionEdit() in XenForo/FrontController.php at line 351
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    XenForo_FrontController->run() in /home/xeno/public_html/xenforo/admin.php at line 13
The thing is, the xf_smilie table has the title column, so I'm confused as to why this error is occuring.

Verifying file sums shows no issues so I'm confused as to what's causing the issue :(
 

silence

Well-known member
#2
Here is dumping categories:
Code:
array(5) {
  [0] => array(2) {
    ["smilie_category_id"] => int(0)
    ["display_order"] => int(0)
  }
  [1] => array(3) {
    ["smilie_category_id"] => int(1)
    ["display_order"] => int(1)
    ["title"] => object(XenForo_Phrase)#182 (4) {
      ["_phraseName":protected] => string(23) "smilie_category_1_title"
      ["_params":protected] => array(0) {
      }
      ["_insertParamsEscaped":protected] => bool(true)
      ["_phraseNameOnInvalid":protected] => bool(true)
    }
  }
  [2] => array(3) {
    ["smilie_category_id"] => int(2)
    ["display_order"] => int(2)
    ["title"] => object(XenForo_Phrase)#36 (4) {
      ["_phraseName":protected] => string(23) "smilie_category_2_title"
      ["_params":protected] => array(0) {
      }
      ["_insertParamsEscaped":protected] => bool(true)
      ["_phraseNameOnInvalid":protected] => bool(true)
    }
  }
  [3] => array(3) {
    ["smilie_category_id"] => int(3)
    ["display_order"] => int(3)
    ["title"] => object(XenForo_Phrase)#181 (4) {
      ["_phraseName":protected] => string(23) "smilie_category_3_title"
      ["_params":protected] => array(0) {
      }
      ["_insertParamsEscaped":protected] => bool(true)
      ["_phraseNameOnInvalid":protected] => bool(true)
    }
  }
  [4] => array(3) {
    ["smilie_category_id"] => int(4)
    ["display_order"] => int(3)
    ["title"] => object(XenForo_Phrase)#180 (4) {
      ["_phraseName":protected] => string(23) "smilie_category_4_title"
      ["_params":protected] => array(0) {
      }
      ["_insertParamsEscaped":protected] => bool(true)
      ["_phraseNameOnInvalid":protected] => bool(true)
    }
  }
 

silence

Well-known member
#3
Modifying prepareSmilieCategory fixes my issue:

Code:
    public function prepareSmilieCategory(array $smilieCategory)
    {
        if (!empty($smilieCategory['smilie_category_id']))
        {
            $smilieCategory['title'] = new XenForo_Phrase($this->getSmilieCategoryTitlePhraseName($smilieCategory['smilie_category_id']));
        }
        else
        {
            $smilieCategory['title'] = new XenForo_Phrase('unknown');
        }

        return $smilieCategory;
    }
 

Brogan

XenForo moderator
Staff member
#4
You shouldn't have to modify the code to resolve that.

I can't reproduce it at all.

Try rebuilding the master data to see if that resolves it.
 

Mike

XenForo developer
Staff member
#6
Sounds like you have a smilie category with no ID? (Or an ID of 0?) That shouldn't be possible unless it was inserted into the DB directly.
 

silence

Well-known member
#7
Sounds like you have a smilie category with no ID? (Or an ID of 0?) That shouldn't be possible unless it was inserted into the DB directly.
Yeah somehow I did D: I did not insert it manually so it's odd how it got there. It had a display_order of 0 as well. I removed it and all is well.