diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index f0f167228050..dfdb7ae7332e 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -712,7 +712,13 @@ public function gatherRouteMiddleware(Route $route) })->flatten()->reject(function ($name) use ($excluded) { if (empty($excluded)) { return false; - } elseif (in_array($name, $excluded, true)) { + } + + if ($name instanceof Closure) { + return false; + } + + if (in_array($name, $excluded, true)) { return true; }