Skip to content

Commit

Permalink
Merge pull request #2 from FelipeUmpierre/middleware
Browse files Browse the repository at this point in the history
Fix middleware call
  • Loading branch information
miladrahimi committed Mar 22, 2016
2 parents f11a897 + 91a3d63 commit a7dee72
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/MiladRahimi/PHPRouter/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ public function dispatch() {
if (method_exists($list[0], $list[1])) {
$mid_args = $arguments;
$mid_args = $this->arrangeMethodArgs($list[0], $list[1], $mid_args);
$this->publish(call_user_func_array($list[0]->$list[1], $mid_args));

$mid_instance = new $list[0];
$this->publish(call_user_func_array(array($mid_instance, $list[1]), $mid_args));
} else {
throw new BadMiddleware('Cannot detect the middleware method');
}
Expand Down

0 comments on commit a7dee72

Please sign in to comment.