mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
Merge pull request #378 from skipperbent/v3-development
Fixed issue with PDO exception not returning correct type for error-code.
This commit is contained in:
@@ -36,7 +36,7 @@ class CookieTokenProvider implements ITokenProvider
|
|||||||
try {
|
try {
|
||||||
return bin2hex(random_bytes(32));
|
return bin2hex(random_bytes(32));
|
||||||
} catch(\Exception $e) {
|
} 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 = [];
|
$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();
|
$url = ($this->request->getRewriteUrl() !== null) ? $this->request->getRewriteUrl() : $this->request->getUrl()->getPath();
|
||||||
|
|
||||||
foreach ($routes as $route) {
|
foreach ($routes as $route) {
|
||||||
@@ -200,11 +205,6 @@ class Router
|
|||||||
*/
|
*/
|
||||||
public function loadRoutes()
|
public function loadRoutes()
|
||||||
{
|
{
|
||||||
// Stop processing routes if no valid route is found.
|
|
||||||
if($this->request->getRewriteRoute() === null && $this->request->getUrl() === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize boot-managers */
|
/* Initialize boot-managers */
|
||||||
/* @var $manager IRouterBootManager */
|
/* @var $manager IRouterBootManager */
|
||||||
foreach ($this->bootManagers as $manager) {
|
foreach ($this->bootManagers as $manager) {
|
||||||
@@ -365,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)
|
public function arrayToParams(array $getParams = [], $includeEmpty = true)
|
||||||
|
|||||||
Reference in New Issue
Block a user