1

I have this simple controller:

<?php
namespace App\Http\Controllers;

use Illuminate\Routing\Controller;
use Illuminate\Http\Request;

class TestController extends Controller
{
    public function indexAction(Request $request)
    {
        return view('test');
    }
}

It loads this simple view:

<!DOCTYPE html>
<html>
    <head>
        <title>Hello World!</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>

When I put it in the web middleware like this I get the Maximum function nesting level... error:

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

If I take the route out of the middleware it works fine. I want to think this is an issue with TwigBridge, but I don't see anyone else reporting it. Is there something I may have missed in my setup?


Edit

Apparently I have to explain why this is not a duplicate of another question. This is specific to Laravel 5.2 and the TwigBridge plugin. It comes up as part of their source code. The item cited as a possible duplicate has nothing to do with Laravel and TwigBridge. This particular error can be generated any number of ways. It comes from xdebug. I'm simply asking what in Laravel, TwigBridge, or my code could be causing this error.


Edit 2

Here's my Kernel.php file as requested:

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
        ],

        'api' => [
            'throttle:60,1',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
    ];
}
LoneWolfPR
  • 3,978
  • 12
  • 48
  • 84
  • 1
    Possible duplicate of [Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHP](http://stackoverflow.com/questions/8656089/solution-for-fatal-error-maximum-function-nesting-level-of-100-reached-abor) – Javier Núñez Jan 26 '16 at 16:18
  • Nope. This is related specifically to the TwigBridge plugin. There are any number of ways to trigger the error with Laravel, but that is not related to my problem. – LoneWolfPR Jan 26 '16 at 16:19
  • As you mention that it works outside of your middleware, could you please provide the contents of your `app/Http/Kernel.php`? Guessing a clash with a middleware you are using, or improper setup of TwigBridge (by the way; it's this one: https://github.com/rcrowe/TwigBridge – correct)? – Marcus Olsson Jan 26 '16 at 16:39
  • I've added the kernel.php file. I am using that TwigBridge with the most recent release. – LoneWolfPR Jan 26 '16 at 16:44

0 Answers0