{"action":"created","issue":{"url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/250","repository_url":"https://api.github.com/repos/rcrowe/TwigBridge","labels_url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/250/comments","events_url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/250/events","html_url":"https://github.com/rcrowe/TwigBridge/issues/250","id":128851639,"number":250,"title":"When run through web middleware causes Maximum function nesting level error","user":{"login":"LoneWolfPR","id":498794,"avatar_url":"https://avatars.githubusercontent.com/u/498794?v=3","gravatar_id":"","url":"https://api.github.com/users/LoneWolfPR","html_url":"https://github.com/LoneWolfPR","followers_url":"https://api.github.com/users/LoneWolfPR/followers","following_url":"https://api.github.com/users/LoneWolfPR/following{/other_user}","gists_url":"https://api.github.com/users/LoneWolfPR/gists{/gist_id}","starred_url":"https://api.github.com/users/LoneWolfPR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LoneWolfPR/subscriptions","organizations_url":"https://api.github.com/users/LoneWolfPR/orgs","repos_url":"https://api.github.com/users/LoneWolfPR/repos","events_url":"https://api.github.com/users/LoneWolfPR/events{/privacy}","received_events_url":"https://api.github.com/users/LoneWolfPR/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-26T15:19:39Z","updated_at":"2016-03-01T22:20:19Z","closed_at":null,"body":"I've defined some very simple controllers loading very simple twig views. When I add routes to these into the web middleware group I get the following error: `Maximum function nesting level of '100' reached, aborting!` When I take the calls out of that group it works fine. There are no redirects or function calls in my code. The function in the controller simply calls a twig view that is a plain html page.\r\n\r\n--\r\nEdit\r\n\r\nIn case it helps the error in the console looks like this:\r\n`PHP Fatal error:  Maximum function nesting level of '100' reached, aborting! in /Users/promer/ap-pltw-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 700`"},"comment":{"url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/comments/190932848","html_url":"https://github.com/rcrowe/TwigBridge/issues/250#issuecomment-190932848","issue_url":"https://api.github.com/repos/rcrowe/TwigBridge/issues/250","id":190932848,"user":{"login":"Ekushisu","id":14139338,"avatar_url":"https://avatars.githubusercontent.com/u/14139338?v=3","gravatar_id":"","url":"https://api.github.com/users/Ekushisu","html_url":"https://github.com/Ekushisu","followers_url":"https://api.github.com/users/Ekushisu/followers","following_url":"https://api.github.com/users/Ekushisu/following{/other_user}","gists_url":"https://api.github.com/users/Ekushisu/gists{/gist_id}","starred_url":"https://api.github.com/users/Ekushisu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ekushisu/subscriptions","organizations_url":"https://api.github.com/users/Ekushisu/orgs","repos_url":"https://api.github.com/users/Ekushisu/repos","events_url":"https://api.github.com/users/Ekushisu/events{/privacy}","received_events_url":"https://api.github.com/users/Ekushisu/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T22:20:19Z","updated_at":"2016-03-01T22:20:19Z","body":"I just got the same problem, I'm a newbie so I though it was coming from me (maybe it is), take a look:\r\n\r\nI've got the kernel.php:\r\n\r\n```\r\n    protected $middlewareGroups = [\r\n        'web' => [\r\n            \\App\\Http\\Middleware\\EncryptCookies::class,\r\n            \\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse::class,\r\n            \\Illuminate\\Session\\Middleware\\StartSession::class,\r\n            \\Illuminate\\View\\Middleware\\ShareErrorsFromSession::class,\r\n            \\App\\Http\\Middleware\\VerifyCsrfToken::class,\r\n            \\App\\Http\\Middleware\\VisitedCookie::class,\r\n        ],\r\n\r\n        'ajax' => [\r\n            \\App\\Http\\Middleware\\AllowOnlyAjaxRequests::class\r\n        ],\r\n\r\n        'api' => [\r\n            'throttle:60,1',\r\n        ],\r\n    ];\r\n```\r\n\r\nWhen I add **VisitedCookie** middleware the error comes.\r\nMy middleware : \r\n```\r\n<?php namespace App\\Http\\Middleware;\r\n\r\nuse Closure;\r\nuse Illuminate\\Http\\Request;\r\nuse Cookie;\r\n\r\nclass VisitedCookie {\r\n    public function handle($request, Closure $next)\r\n    {\r\n        if (Cookie::get('visitedToday'))\r\n            return $next($request);\r\n\r\n        Cookie::queue(\"visitedToday\", true, 86400);\r\n        return $next($request);\r\n    }\r\n}\r\n```"}}