简体   繁体   中英

Laravel 5.2, Maximum function nesting level

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM