From 4f07f38cf58bf95886ffa3ee539ee291ba980aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Sat, 12 Dec 2015 23:38:48 +0100 Subject: [PATCH] [BUGFIX] Fixed getting current route not always returning current url. --- src/Pecee/SimpleRouter/RouterBase.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index f1c3e5d..8247130 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -280,9 +280,18 @@ class RouterBase { throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null'); } + // Return current route if no options has been specified if($controller === null && $parameters === null && $this->loadedRoute !== null) { $getParams = (is_array($getParams)) ? array_merge($_GET, $getParams) : $_GET; - return $this->processUrl($this->loadedRoute, null, null, $getParams); + + $url = parse_url(Request::getInstance()->getUri()); + $url = $url['path']; + + if(count($getParams)) { + $url .= '?' . $this->arrayToParams($getParams); + } + + return $url; } $c = '';