From 1054fd2523913e59e980553b5411a22f16ecf817 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 25 Jan 2017 07:26:42 -0600 Subject: [PATCH] fix bug with pushMiddleware --- src/Illuminate/Routing/Router.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Routing/Router.php b/src/Illuminate/Routing/Router.php index a3709ebd155e..78bc59604a03 100644 --- a/src/Illuminate/Routing/Router.php +++ b/src/Illuminate/Routing/Router.php @@ -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; }