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

ACL Controllercase - Dispatcher has detected a cyclic routing causing stability problems

So, i don't know if this is a problem caused by my lack of consideration or a problem in the framework, but since it caused me some headaches i leave this here.

Following both, the INVO tutorial and the Access Control List Reference i came upon this behaviour:

My controller filenames are written uppercase, like Controller. No changes where made in phalcon config regarding prefixes or routing etc.

The Security class receives the current controller via $dispatcher->getControllerName() and this gives back a lowercase controller name.

In INVO, controller resources are written lowercase, and everything works, but if you follow the ACL Reference and write your res uppercase like $acl->addResource("Controller") yep,... thats what probably brought you here then ;)

edited Apr '15

I had the same problem. The cause of it was chcecking permissions of role which didn't exist.

//Register two roles Users is registered user
//and Guest are users without defined identity
$roles = array(
    'users' => new \Phalcon\Acl\Role('Users'),
    'guests' => new \Phalcon\Acl\Role('Guest') //the role name should be 'Guests' not 'Guest'
);

...

$auth = $this->session->get('auth');
if (!$auth) {
    $role = 'Guests';
} else {
    $role = 'Users';
}

...

//check if the role have access to the controller (resource)
$allowed = $acl->isAllowed($role, $controller, $action);