mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-23 19:49:15 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8111de48fd | |||
| 79c82c90cc | |||
| 0dbc4e6ba2 | |||
| 6d7d07669b | |||
| a4dfa59a66 | |||
| 98bf95bfc9 | |||
| b051bcf02b | |||
| b8d5106f4e | |||
| 2c9d996437 | |||
| cfc9ac138a |
@@ -217,7 +217,7 @@ class Request
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = is_string($url) ? new Url($url) : $url;
|
||||
$this->url = ($url instanceof Url) ? $url : new Url($url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,7 +36,7 @@ class CookieTokenProvider implements ITokenProvider
|
||||
try {
|
||||
return bin2hex(random_bytes(32));
|
||||
} catch(\Exception $e) {
|
||||
throw new SecurityException($e->getMessage(), $e->getCode(), $e->getPrevious());
|
||||
throw new SecurityException($e->getMessage(), (int)$e->getCode(), $e->getPrevious());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,11 @@ class Router
|
||||
|
||||
$exceptionHandlers = [];
|
||||
|
||||
// Stop processing routes if no valid route is found.
|
||||
if($this->request->getRewriteRoute() === null && $this->request->getUrl() === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = ($this->request->getRewriteUrl() !== null) ? $this->request->getRewriteUrl() : $this->request->getUrl()->getPath();
|
||||
|
||||
foreach ($routes as $route) {
|
||||
@@ -360,7 +365,7 @@ class Router
|
||||
}
|
||||
}
|
||||
|
||||
throw new HttpException($e->getMessage(), $e->getCode(), $e->getPrevious());
|
||||
throw new HttpException($e->getMessage(), (int)$e->getCode(), $e->getPrevious());
|
||||
}
|
||||
|
||||
public function arrayToParams(array $getParams = [], $includeEmpty = true)
|
||||
|
||||
Reference in New Issue
Block a user