Skip to content

Commit

Permalink
fix reflection exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 25, 2020
1 parent 44a8663 commit c6e8357
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,14 @@ public function gatherRouteMiddleware(Route $route)
return true;
}

if (! class_exists($name)) {
return false;
}

$reflection = new ReflectionClass($name);

return collect($excluded)->contains(function ($exclude) use ($reflection) {
return $reflection->isSubclassOf($exclude);
return class_exists($exclude) && $reflection->isSubclassOf($exclude);
});
})->values();

Expand Down

0 comments on commit c6e8357

Please sign in to comment.