We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Error - Dispatcher has detected a cyclic routing causing stability problems

How this error comes (Dispatcher has detected a cyclic routing causing stability problems)? I'm making forward to another controller action.



98.9k
Accepted
answer

If the dispatch loop makes more than 256 loops it throws this exception. Normally this is caused because the application continue making forwards over and over without exiting the dispatch loop. https://github.com/phalcon/cphalcon/blob/2.0.0/phalcon/dispatcher.zep#L378

So on forward, the dispatcher will fire the events again for listeners, thats what I noted since I put my forward inside beforeExecuteRoute function.

Thank you for help it works now:

<?php if($this->dispatcher->getControllerName() != 'forward_controller') // .. ?>



1.1k

i am also gettin same error "Dispatcher has detected a cyclic routing causing stability problems"