更新:问题不在于服务器代码,而在于Behat执行环境。
我正在开发一个Symfony2项目,不知何故,经过几个月的开发,我引入了一个崩溃整个应用程序并输出以下错误消息的错误:
PHP Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php on line 289
PHP Stack trace:
PHP 1. {main}() /home/vagrant/.phpstorm_helpers/behat.php:0
PHP 2. Symfony\Component\Console\Application->run() /home/vagrant/.phpstorm_helpers/behat.php:423
PHP 3. Behat\Testwork\Cli\Application->doRun() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
PHP 4. Behat\Testwork\Cli\Application->createCommand() /var/www/main_api/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:96
PHP 5. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:138
PHP 6. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
PHP 7. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
PHP 8. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 9. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 10. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 11. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 12. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
PHP 13. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
PHP 14. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
PHP 15. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 16. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 17. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
PHP 18. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
[...]
PHP 93. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
PHP 94. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
PHP 95. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
PHP 96. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 97. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
PHP 98. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
PHP 99. Symfony\Component\DependencyInjection\Container->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:469
Fatal error: Maximum function nesting level of '100' reached, aborting! in /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php on line 289
Call Stack:
0.0010 412904 1. {main}() /home/vagrant/.phpstorm_helpers/behat.php:0
0.4579 3401528 2. Symfony\Component\Console\Application->run() /home/vagrant/.phpstorm_helpers/behat.php:423
0.4900 3747408 3. Behat\Testwork\Cli\Application->doRun() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
0.4900 3747392 4. Behat\Testwork\Cli\Application->createCommand() /var/www/main_api/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:96
1.7987 7874496 5. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/behat/behat/src/Behat/Testwork/Cli/Application.php:138
1.7987 7876432 6. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
1.7991 7879072 7. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
1.7991 7879560 8. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
1.7991 7880392 9. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
1.7991 7880880 10. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.0948 14305112 11. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.0948 14305200 12. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
3.0948 14305496 13. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
3.0949 14306208 14. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
3.0949 14306696 15. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1179 14383304 16. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1179 14383416 17. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
3.1180 14383760 18. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
[...]
3.1192 14540512 79. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
3.1193 14540952 80. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
3.1193 14541440 81. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1193 14542096 82. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1193 14542144 83. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1019
3.1193 14542584 84. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
3.1193 14543072 85. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1193 14543728 86. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1193 14543816 87. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
3.1194 14544112 88. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
3.1244 14552552 89. Symfony\Component\DependencyInjection\ContainerBuilder->callMethod() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:975
3.1244 14553384 90. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1165
3.1244 14553872 91. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1244 14554464 92. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1244 14554568 93. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
3.1245 14554896 94. Symfony\Component\DependencyInjection\ContainerBuilder->createService() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:490
3.1246 14555512 95. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:943
3.1246 14556000 96. array_map() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1247 14557184 97. Symfony\Component\DependencyInjection\ContainerBuilder->resolveServices() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1015
3.1247 14557280 98. Symfony\Component\DependencyInjection\ContainerBuilder->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:1017
3.1247 14557424 99. Symfony\Component\DependencyInjection\Container->get() /var/www/main_api/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:469
Process finished with exit code 255
我认为这是因为服务之间的循环依赖,是否可能?如果是这种情况,是否有系统的方法在Symfony中找到服务之间的循环依赖关系?
答案 0 :(得分:0)
最后,这不是我的代码中的问题,而是在Behat执行环境中。
我必须使用/etc/php5/cli/php.ini
文件中的以下条目更改最大嵌套级别(我在Debian上):
[XDebug]
xdebug.max_nesting_level = 1000