Skip to content

Commit

Permalink
fix bug with pushMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 25, 2017
1 parent d3a9258 commit 1054fd2
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 @@ -724,7 +724,11 @@ public function prependMiddlewareToGroup($group, $middleware)
*/
public function pushMiddlewareToGroup($group, $middleware)
{
if (isset($this->middlewareGroups[$group]) && ! in_array($middleware, $this->middlewareGroups[$group])) {
if (! array_key_exists($group, $this->middlewareGroups)) {
$this->middlewareGroups[$group] = [];
}

if ( ! in_array($middleware, $this->middlewareGroups[$group])) {
$this->middlewareGroups[$group][] = $middleware;
}

Expand Down

1 comment on commit 1054fd2

@acacha
Copy link

@acacha acacha commented on 1054fd2 Jan 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference see: #17533

Please sign in to comment.