From 54ae628f4e23bf524217d0cc278dfa1e95d0068d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Wed, 21 Oct 2015 15:22:09 +0200 Subject: [PATCH] =?UTF-8?q?[BUGFIX]=C2=A0Fixed=20middleware=20not=20loadin?= =?UTF-8?q?g=20and=20giving=20"class=20must=20be=20instance=20of=20Middlew?= =?UTF-8?q?are"=20exception.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Pecee/SimpleRouter/RouterEntry.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pecee/SimpleRouter/RouterEntry.php b/src/Pecee/SimpleRouter/RouterEntry.php index 03a88fe..37fa567 100644 --- a/src/Pecee/SimpleRouter/RouterEntry.php +++ b/src/Pecee/SimpleRouter/RouterEntry.php @@ -245,13 +245,13 @@ abstract class RouterEntry { protected function loadMiddleware(Request $request) { if($this->getMiddleware()) { - if (!($this->getMiddleware() instanceof Middleware)) { + $middleware = $this->loadClass($this->getMiddleware()); + if (!($middleware instanceof Middleware)) { throw new RouterException($this->getMiddleware() . ' must be instance of Middleware'); } /* @var $class Middleware */ - $class = $this->loadClass($this->getMiddleware()); - $class->handle($request); + $middleware->handle($request); } }