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

Fatal error: Phalcon\Mvc\View\Engine\Volt\Compiler::attributeReader(): Maximum recursion depth exceeded

Hello,

I am getting this error on my server out of the blue (on my local computer it is working fine under Apache2 and nginx). I am using NGINX on the server.

Do anyone knows what is needed to change to make it work?

Issue is here:

In the template I am using "widget" for menu

{{ widgets.renderTopMenu() }}

This is handled by:

class Widgets extends \Phalcon\Mvc\User\Component
{
    protected function tmplRender($tmpl)
    {
        $this->view->start();
        //render $tmpl.volt stored in /views/widgets/$tmpl.vol
        $this->view->render('widgets',$tmpl); // <-- here the cycle happens
        $this->view->finish();
        return $this->view->getContent();
    }

    public function renderTopMenu()
    {
        $menu = array ....;
        $this->view->setVar('menu', $menu);
        return $this->tmplRender('top-menu');
    }
}

Thank you for your help!



98.9k

This probably means you have a recursive function causing this error. Maybe:

$this->view->render('widgets',$tmpl); //this is rendering widgets too

I am not sure with recursion here as it working on local and was working also on the server yesterday...

this row is only one which is rendering something

$this->view->render('widgets',$tmpl); 

and the result is just catched and returned via $this->view->getContent();

Problem is there also when template 'top-menu.volt' is empty so there should not be problem inside template.

I will try some remote debugging if it will be possible.



11.7k
Accepted
answer

Solved - but I really don't know the reason...

I deleted all templates where I made changes yesterday from server (not top-menu template). Then it started to work normally. After uploading them back it still works.

I also tried to clear cache dir several times without but it didn't helped.