Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
404 router multiple recursion problem
  • files : http://scrp.at/ZB but 404 has right destination because when i remove '(:segment)/(:num)' => "obchod/kategoria/$1/$2", line from router 404 working example
    return array(
        '_root_' => 'uvod', // The default route
        '_404_' => 'kancelarske/404', // The main 404 route
        '(:segment)/(:num)' => "obchod/kategoria/$1/$2",
    };
    
    domain.tld/blabla (404 recursion error as in Scrap)
    domain.tld/obchod/kategoria/existingcategory (work ok) === example
    return array(
        '_root_' => 'uvod', // The default route
        '_404_' => 'kancelarske/404', // The main 404 route
    };
    
    domain.tld/blabla (404 work ok) but i need working:
    domain.tld/blabla (400)
    domain.tld/obchod/kategoria/nonexistcategory (404)
    domain.tld/obchod/kategoria/existingcategory (200) THANKS
  • If you get a 404 recursion error, it means your 404 route is not correct. According to your config, it tries to load an app controller called kancelarske, and call the action_404 method in that controller. If either the controller can't be loaded, or the controller doesn't have a public method called action_404, a not-found situation is triggered, and since you're already in a not-found situation, that would mean recursion. So check your config, and your controller code for errors.
  • as i writed _404_ work when line
    '(:segment)/(:num)' => "obchod/kategoria/$1/$2",
    

    is not in router.php its a complex problem i mean. _404_ is setted corect i mean. is it other problem i think
  • Look closely at what you have configured. You request something that doesn't exist. Fuel detects this, and loads the 404 route. It feeds the route into the Request object, which gets routed. Now, "kancelarske/404" matches your new "(:segment)/(:num)" route, so the 404 request is now routed to "obchod/kategoria/kancelarske/404". If that causes a 404, you still have a recursive route, Fuel knows it's been through the 404 process before...
  • but in obchod/kategoria i have
            if ( Session::get('kategoria') == NULL )
            {
                Request::show_404();
            }
    

    and when dont exist Session::get('kategoria') is really NULl what i want.. if category doesnt exist show 404 page
  • So make sure your 404 route doesn't get routed somewhere else...
  • Just pushed an update to the develop branch that checks the 404 route with and without route processing, before failing with a recursion error. This should provide a workaround for your problem. Note that the preferred solution is still to make sure no recursive routing happens.
  • now its ok. thanks

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion