Not a bug [MISTAKE] Error If controller doesn't exist

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
If we use a controller, which doesn't exist, xenforo shows only

The controller foobar_Ragtek_PC_ControllerPublic_PageEdit does not define an action called Changecommentstate.

Which means, that there is a foobar_Ragtek_PC_ControllerPublic_PageEdit controller but he doesn't have a action called Changecommentstate.

But that's wrong, because the error should show that the controller doesn't exist

PS.

Wouldn't be public function actionErrorNotFound() which can be found in XenForo_ControllerPublic_Error AND XenForo_ControllerAdmin_Error be a candidate for XenForo_ControllerPublic_Abstract ???

It's the exact same method in both controllers ( => DRY)
 
Possible "bugfix" :

try to load the class once again, if it's found, the method is missing, if not, the controller is missing:)
PHP:
public function actionErrorNotFound()
    {
        if (XenForo_Application::debugMode())
        {
            $controllerName = $this->_request->getParam('_controllerName');

           ....
            else
            {

                if (XenForo_Application::autoload($controllerName)){
                    return $this->responseError(
                    new XenForo_Phrase('controller_x_does_not_define_action_y', array
                    (
                        'controller' => $controllerName,
                        'action' => $this->_request->getParam('_action')
                    )), 404
                );
                }
                else {
                    return $this->responseError(
                    'wrong controller', 404
                );
                }

            }
        }
        else
        {
            return $this->responseError(new XenForo_Phrase('requested_page_not_found'), 404);
        }
    }
 
Perhaps I'm missing something here, but hasn't this been handled since 1.0.2? Which case is not being dealt with?

Controller exists, action does not:

Screen shot 2011-07-05 at 09.36.25.webp

Controller does not exist:

Screen shot 2011-07-05 at 09.36.46.webp
 
Top Bottom