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

Fixed Undefined variable $source in \library\XenForo\BbCode\Formatter\Base.php

Discussion in 'Resolved Bug Reports' started by Yoskaldyr, Dec 12, 2010.

  1. Yoskaldyr

    Yoskaldyr Well-Known Member

    Please consider of adding one line of code into file \library\XenForo\BbCode\Formatter\Base.php on line 1110:
    Find
    PHP:
            else
            {
                
    $name false;
            }
    Replace with
    PHP:
            else
             {
                 
    $name false;
                 
    $source false;
              }
    I'm asking of this, because I've got an error (Method XenForo_BbCode_TextWrapper::__toString() must not throw an exception) while processing quote bbcode without options in my add-on.
    Code of My_ViewPublic_Post class (from my test add-on):
    PHP:
    class My_ViewPublic_Post extends XenForo_ViewPublic_Base
    {
        public function 
    renderHtml()
        {
            
    $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
            
    $this->_params['messageParsed'] = new XenForo_BbCode_TextWrapper($this->_params['message'], $bbCodeParser);
        }
    }
    That happens because of undefined variable $source in the source code (\library\XenForo\BbCode\Formatter\Base.php) in line 1120:
    PHP:
            if ($this->_view)
            {
                
    $template $this->_view->createTemplateObject('bb_code_tag_quote', array(
                    
    'content' => $content,
                    
    'nameHtml' => $name,
                    
    'source' => $source
                
    ));
                return 
    $template->render();
            }
     
  2. Mike

    Mike XenForo Developer Staff Member

    I'm surprised this hasn't been triggered before TBH, but fixed regardless. Thanks.
     
    Rob Fritz, Romchik® and Yoskaldyr like this.
  3. Kaiser

    Kaiser Well-Known Member

    Should I wait for the next release, or just update it myself?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Unless you're having issues due to the bug then just wait for the next release.
     

Share This Page