現象
Laravelで構築中に以下のようなメッセージが出た。
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Maximum function nesting level of '100' reached, aborting!' in ~vendor/composer/ClassLoader.php:
原因
xdebugのxdebug.max_nesting_level = 100になっているため。
php -i
~~
xdebug.max_nesting_level => 100 => 100
~~
対処法
1 Laravel DebugBarを使っている場合使用をやめる。
Laravel5の場合.envの
APP_DEBUG = true
をfalseにすれば消えるため実行が可能になる・・・が、デバッグがしづらくなるのでなるべくならこの方法はとりたくない
2 xdebugの設定をする。
php.iniのxdebug.max_nesting_levelを引き上げる。
xdebug.max_nesting_level = 200
参考
https://laracasts.com/discuss/channels/general-discussion/xdebug-max-nesting-level-reached
https://teratail.com/questions/169
http://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor