Laravel 5.2, Maximum function nesting level

烈酒焚心 提交于 2021-01-29 03:06:22

问题


Please, help me to find what is going on. I just set up a basic Laravel project. It's a new fresh Laravel project (5.2.29)

This is route.php

Route::get('/', 'TestController@index');

This is the test controller

class TestController extends Controller
{
    public function index()
    {
        return view('home');
    }
}

The home.blade.php is the one that comes with a fresh Laravel installation, the one printing "Laravel 5".

When I add the 'web' middleware, as following

Route::group(['middleware' => ['web']], function () {
    Route::get('/', 'TestController@index');
});

I get this error: "Maximum function nesting level of '100' reached, aborting!". I read some thread about xDebug, so i add this line to xdebug.ini

xdebug.max_nesting_level = 1000

but nothing changed.

Any help? Or any suggestion on what else could I check? Thank you


回答1:


Try to remove web middleware, because now it applies automatically to all routes. So, since v5.2.27 you do not need to apply web middleware to avoid errors.




回答2:


If you installed new application (5.2.27 at the moment of installation), you don't have to use web middleware group because it will be automatically applied, however if you installed version prior to 5.2.27 and then updated to 5.2.27 or later you still need to use it.

So first you need to verify app/Providers/RouteServiceProvider.php if there's web middleware group automatically applied. If yes, you should remove it from routes.php because you might get unexpected behaviour.

If it's not the case, you should verify what Middleware are included into web middleware group because some of them might cause problems



来源:https://stackoverflow.com/questions/36579389/laravel-5-2-maximum-function-nesting-level

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!