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

Lack of interest Output throws error if a nodehandler doesn't exist

R

ragtek

Guest
#1
In XenForo_Model_Node::getNodeHandlersForNodeTypes you check if the handler class for the nodetypeid is set.
If it isn't set, you set the classname as an empty string.
PHP:
    public function getNodeHandlersForNodeTypes(array $nodeTypeIds)
    {
        $nodeTypes = $this->getAllNodeTypes();

        $output = array();
        foreach ($nodeTypeIds AS $nodeTypeId)
        {
            $class = isset($nodeTypes[$nodeTypeId]) ? $nodeTypes[$nodeTypeId]['handler_class'] : '';
            $output[$nodeTypeId] = new $class();
        }

        return $output;
    }
That brings an ugly fatal error
Fatal error: Class '' not found in D:xampp\xampp\htdocs\xf\library\XenForo\Model\Node.php on line 515
if it's not set.
IMHO this shouldn't brake the system.
I know, this will only happen if the add-on deinstall code isn't deleting the existing nodes, but maybe you could use here a "empty alias node handler" class for this?