Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gevorgmansuryan committed Jul 26, 2018
1 parent 1c815d4 commit 4e2580f
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use yii\helpers\ArrayHelper;
use yii\web\Application;
use yii\web\UrlManager;
use yii\web\UrlNormalizerRedirectException;
use yii\web\UrlRule;

/**
Expand Down Expand Up @@ -63,16 +64,21 @@ public function dispatch()
call_user_func($route->callable, $rule);
}

if ($request = $rule->parseRequest($this->urlManager, $app->request)) {
$params = ArrayHelper::merge($request, [$event]);
foreach ($route->getMiddleware() as $callBack) {
if (is_callable($callBack)) {
call_user_func_array($callBack, $params);
} else {
call_user_func_array([$callBack, 'handle'], $params);
try {
if ($request = $rule->parseRequest($this->urlManager, $app->request)) {
$params = ArrayHelper::merge($request, [$event]);
foreach ($route->getMiddleware() as $callBack) {
if (is_callable($callBack)) {
call_user_func_array($callBack, $params);
} else {
call_user_func_array([$callBack, 'handle'], $params);
}
}
}
} catch (UrlNormalizerRedirectException $e) {
//ignore this at this time
}

$this->urlManager->addRules([$rule], true);
if ($route->alias) {
Yii::setAlias($route->alias, $config['route']);
Expand Down

0 comments on commit 4e2580f

Please sign in to comment.