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

Not a Bug XenForo_Template_Abstract::_renderInternal has useless parameter

Discussion in 'Resolved Bug Reports' started by tyteen4a03, Jul 8, 2013.

  1. tyteen4a03

    tyteen4a03 Well-Known Member

    EDIT: Actually, I see how the workflow works now. I would have made _renderInternal return an array, but to each their own.

    Oh well. Mods can move this as Not a Bug.

    I was digging through the code to answer this question when I came across that function.

    Here is the render function:

    Code:
        public function render()
        {
            $__template = $this->_loadTemplate($this->_templateName);
            if ($__template === '')
            {
                return '';
            }
    
            XenForo_Phrase::loadPhrases();
    
            set_error_handler(array($this, 'handleTemplateError'));
            $this->_templateErrors = array();
    
            $__output = $this->_renderInternal($__template, $__extraData);
    
            restore_error_handler();
    
            XenForo_CodeEvent::fire('template_post_render', array($this->_templateName, &$__output, &$__extraData, $this), $this->_templateName);
    
            if (is_array($__extraData) && !empty($__extraData))
            {
                $this->_mergeExtraContainerData($__extraData);
            }
            blah blah blah...
    
    Here is the _renderInternal function:

    Code:
        protected function _renderInternal($__template, &$__extraData)
        {
            $__params = $this->_params; // special variable for dumping purposes
            extract($this->_params);
    
            $__output = '';
            $__extraData = array();
    
            if ($this->_usingTemplateFiles())
            {
                if (file_exists($__template))
                {
                    include($__template);
                }
            }
            else
            {
                eval($__template);
            }
    
            return $__output;
        }
    
    If you track the workflow of render(), $__extraData is never defined (except if maybe you're in the installer). Also, in _renderInternal, $__extraData gets manually set to an empty array. Hence, _renderInternal's extra parameter $__extraArray is not needed.
     

Share This Page