1

Hello I was trying to run the following console command

console cache:clear --env=prod

but i got the following error

Fatal error: Maximum function nesting level of '100' reached, aborting! in vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader.php on line 66

executing with --no-debug throw the same error, however when run the following command

console cache:clear --env=prod --no-optional-warmers

the cache is cleared and generated fine, but Twig templates are not generated and will be generated on runtime when some user navigate to the site, causing that the user to wait longer than usual.

What can cause this error?, Seems an error when generating the views, but why and how fix this?, thanks

I have Symfony 2.6 and php 5.5

rafrsr
  • 1,940
  • 3
  • 15
  • 31
  • Do `$ rm -rf app/cache/*` in your project directory and try clearing the cache again to check for this error maybe? – D4V1D Mar 28 '15 at 15:54
  • Thanks for your fast answer, but deleting the entire cache folder content don't resolve the problem, already try with this and the problem persists. However when I drop the cache folder content and navigate in the browser the cache is generated success without any error log or warning, but the time to wait is too long for customers. Doing the same, drop all cache content, and generating cache with the above command or the following command: php console cache:warmup --env=prod throw the "Maximum function nesting level" error – rafrsr Mar 28 '15 at 16:09

1 Answers1

3

This is due to the xdebug.max_nesting_level PHP setting, which defaults to 100.

This directive limits recursion to 100 calls which may not be enough for rendering the form in the template if you render the whole form at once (e.g form_widget(form)). To fix this you can set this directive to a higher value (either via a php.ini file or via ini_set(), for example in app/autoload.php) or render each form field by hand using form_row.

D4V1D
  • 5,805
  • 3
  • 30
  • 65
ghanbari
  • 1,630
  • 1
  • 16
  • 31