1. 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

Discussion in 'Resolved Bug Reports' started by ragtek, Jun 6, 2011.

  1. ragtek

    ragtek Guest

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

    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)
     
    Alluidh likes this.
  2. ragtek

    ragtek Guest

    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);
            }
        }
     
    Alluidh likes this.
  3. Kier

    Kier XenForo Developer Staff Member

    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
     
    Vincent likes this.
  4. ragtek

    ragtek Guest

    my failure.
     
    Vincent likes this.
  5. Kier

    Kier XenForo Developer Staff Member

    No problem ;)
     
    Vincent likes this.

Share This Page