Skip to content

Commit a7dee72

Browse files
committed
Merge pull request #2 from FelipeUmpierre/middleware
Fix middleware call
2 parents f11a897 + 91a3d63 commit a7dee72

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/MiladRahimi/PHPRouter/Router.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ public function dispatch() {
218218
if (method_exists($list[0], $list[1])) {
219219
$mid_args = $arguments;
220220
$mid_args = $this->arrangeMethodArgs($list[0], $list[1], $mid_args);
221-
$this->publish(call_user_func_array($list[0]->$list[1], $mid_args));
221+
222+
$mid_instance = new $list[0];
223+
$this->publish(call_user_func_array(array($mid_instance, $list[1]), $mid_args));
222224
} else {
223225
throw new BadMiddleware('Cannot detect the middleware method');
224226
}

0 commit comments

Comments
 (0)