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

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

R

ragtek

Guest
#1
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)
 
R

ragtek

Guest
#2
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);
        }
    }
 

Kier

XenForo Developer
Staff member
#3
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.png

Controller does not exist:

Screen shot 2011-07-05 at 09.36.46.png