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

"'Phalcon\Acl\Exception' with message 'Invalid value for accessList' in phalcon/acl/adapter/memory.zep:290"

Trying out an app within Phalcon 2.0.0 and I'm getting this error when it loads up:

Fatal error: Uncaught exception 'Phalcon\Acl\Exception' with message 'Invalid value for accessList' in phalcon/acl/adapter/memory.zep:290 Stack trace: #0 [internal function]: Phalcon\Acl\Adapter\Memory->addResourceAccess('financial', NULL) #1 /var/www/vhosts/gemini.dev/public_html/vendor/phalcon/incubator/Library/Phalcon/Acl/Factory/Memory.php(85): Phalcon\Acl\Adapter\Memory->addResource(Object(Phalcon\Acl\Resource), NULL) #2 /var/www/vhosts/gemini.dev/public_html/vendor/phalcon/incubator/Library/Phalcon/Acl/Factory/Memory.php(59): Phalcon\Acl\Factory\Memory->addResources() #3 /var/www/vhosts/gemini.dev/public_html/app/config/services.php(98): Phalcon\Acl\Factory\Memory->create(Object(Phalcon\Config)) #4 [internal function]: {closure}() #5 [internal function]: Phalcon\Di\Service->resolve(NULL, Object(Phalcon\Di\FactoryDefault)) #6 [internal function]: Phalcon\Di->get('acl', NULL) #7 [internal function]: Phalcon\Di->getShared('acl') #8 /var/www/vhosts/gemini.dev/public_html/app/components/Security.php(18): Phalcon\Di->offs in phalcon/acl/adapter/memory.zep on line 290

It's being caused by how I'm implimenting Access Control Lists at the moment. In my services.php I have:

    $di->set('dispatcher', function() use ($di) {

        $eventsManager = $di->getShared('eventsManager');

        //Custom ACL Class
        $security = new Security($di);

        //Listen for events from the permission class
        $eventsManager->attach('dispatch', $security);

        $dispatcher = new \Phalcon\Mvc\Dispatcher();
        return $dispatcher;

I've read the upgrade blog and it's talking about implimenting interfaces which is all cool but I'm wondering if anyone else has hit this. I still have incubator installed from the previous version do I need to deal with that in some way. I've just done a composer update. Any tips on this would be most appreciated I'm a bit stuck at the moment. Time to learn something new!


I got round it:

Inside Phalcon\Acl\Factory\Memory there is ...

            public function create(\Phalcon\Config $config)
                $this->acl = new \Phalcon\Acl\Adapter\Memory();
                $this->config = $config;

                if (!is_numeric($this->config->get('defaultAction'))) {
                    throw new \Phalcon\Acl\Exception('Key "defaultAction" must exist and must be of numeric value.');
                $this->acl->setDefaultAction((int) $this->config->defaultAction);
                return $this->acl;

It's failing on $this->addRescources(); which has ...

    protected function addResources()
        if (!(array)$this->config->get('resource')) {
            throw new \Phalcon\Acl\Exception('Key "resource" must exist and must be traversable.');

        // resources
        foreach ($this->config->resource as $name => $resource) {
            $actions = (array) $resource->get('actions');
            if (!$actions) {
                $actions = null;
                $this->makeResource($name, $resource->description),

        return $this;

It seems that passing a null inside of $actions to $this->acl->addResource() is breaking things so I commented out $actions = null; and replaced it with a continue; and it's happy now. But is that the best thing to do?