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

XenForo unable to find class, even though it exists

#1
Hello,

I'm having a problem with XenForo and my plugin which extends a XenForo class. XenForo will output
Code:
Fatal error: Class 'LazyLoad_XenForo_BbCode_Formatter_Base' not found in /srv/www/test.mineskene.fi/httpdocs/library/XenForo/BbCode/Formatter/Base.php on line 1923
Even though this class exists.

library/LazyLoad/Listener.php
PHP:
<?php

class LazyLoad_Listener {

    /**
     * Instruct the system that XenForo_BbCode_Formatter_Base
     * should be extended by LazyLoad_BbCode_Formatter_Base
     *
     * @param string $class
     * @param array $extend
     */
     public static function extendBbCodeFormatter($class, array &$extend) {
        if($class == 'XenForo_BbCode_Formatter_Base')
            $extend[] = 'LazyLoad_XenForo_BbCode_Formatter_Base';
     }
    
    /**
     * Instruct the system that XenForo_ProxyOutput
     * should be extended by LazyLoad_ProxyOutput
     *
     * @param string $class
     * @param array $extend
     */
    public static function extendImageProxyOutput($class, array &$extend) {
        if($class == 'XenForo_ProxyOutput')
            $extend[] = 'LazyLoad_ProxyOutput';
    }
}
library/LazyLoad/Xenforo/BbCode/Formatter/Base.php
PHP:
<?php

class LazyLoad_XenForo_BbCode_Formatter_Base extends XFCP_LazyLoad_XenForo_BbCode_Formatter_Base {

    /**
     * Renders a img tag.
     *
     * @param array $tag Information about the tag reference; keys: tag, option, children
     * @param array $rendererStates Renderer states to push down
     *
     * @return string Rendered tag
     */
    public function renderTagImage(array $tag, array $rendererStates)
    {
        $response = parent::renderTagImage($tag, $renderStates);
       
        return $response;
    }

}
Code Event Listener


What is wrong with this?
 

Chris D

XenForo developer
Staff member
#3
Many people have already :)

It's common. Ironically, I was specifically looking for a similar mistake in your code on my mobile as I was walking to go and do something else. I didn't spot it!