是什么导致了“最大函数嵌套级别"?Symfony 2.1 和 Twig 中的错误?嵌套、函数、级别、错误

2023-09-06 23:40:09 作者:爱,可否卷土重来?

我有一个关于 Symfony 2.1 的项目.更新作曲家组件(Gedemo、Symfony 核心、Doctrine、Twig 等)后,出现以下错误:

I have a project on Symfony 2.1. After updating composer components (Gedemo, Symfony core, Doctrine, Twig, etc..) I have the following error:

Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/{path}/vendor/twig/twig/lib/Twig/Token.php on line 78

我有 PHP 5.4.什么可能导致此错误?

I have PHP 5.4. What can cause this error?

推荐答案

找到 xdebug.ini 文件:

$ locate xdebug.ini
/etc/php5/conf.d/20-xdebug.ini
/etc/php5/mods-available/xdebug.ini

在我的例子中,文件是 /etc/php5/conf.d/20-xdebug.ini.打开它并添加这一行:

In my case the file is /etc/php5/conf.d/20-xdebug.ini. Open it and add this line:

xdebug.max_nesting_level = 1000

别忘了重启 FPM 服务器.

Don't forget to restart the FPM server.