Skip to content

Commit 6182a7c

Browse files
committed
Bugfix: Urlencoded query strings would cause the router to miss defined routes
1 parent 336fd48 commit 6182a7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/MiladRahimi/PHPRouter/Request.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ class Request
127127
private function __construct(Router $router)
128128
{
129129
$this->router = $router;
130-
$u = $this->uri = urldecode($_SERVER["REQUEST_URI"]);
130+
$u = $_SERVER["REQUEST_URI"];
131+
$this->uri = urldecode($u);
131132
$q = $this->query_string = $_SERVER["QUERY_STRING"];
132133
$this->page = trim(substr($u, 0, strlen($u) - strlen($q)), '?');
133134
$this->method = $_SERVER["REQUEST_METHOD"];
@@ -319,4 +320,4 @@ public function getReferer()
319320
return $this->referer;
320321
}
321322

322-
}
323+
}

0 commit comments

Comments
 (0)