Compare commits

..

4 Commits

Author SHA1 Message Date
Simon Sessingø 6e247f811f Merge pull request #381 from skipperbent/v3-development
Throw correct exception-types.
2018-02-27 09:04:57 +01:00
Simon Sessingo be39010be3 Throw correct exception-types. 2018-02-27 08:58:57 +01:00
Simon Sessingø 8111de48fd Merge pull request #378 from skipperbent/v3-development
Fixed issue with PDO exception not returning correct type for error-code.
2018-02-27 08:36:43 +01:00
Simon Sessingo 79c82c90cc Fixed issue with PDO exception not returning correct type for error-code. 2018-02-27 08:20:25 +01:00
3 changed files with 10 additions and 7 deletions
@@ -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());
}
}
+8 -6
View File
@@ -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) {
@@ -200,11 +205,6 @@ class Router
*/
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 */
/* @var $manager IRouterBootManager */
foreach ($this->bootManagers as $manager) {
@@ -221,6 +221,7 @@ class Router
* @param bool $rewrite
* @return string|mixed
* @throws HttpException
* @throws \Exception
*/
public function routeRequest($rewrite = false)
{
@@ -334,6 +335,7 @@ class Router
/**
* @param \Exception $e
* @throws HttpException
* @throws \Exception
* @return string
*/
protected function handleException(\Exception $e)
@@ -365,7 +367,7 @@ class Router
}
}
throw new HttpException($e->getMessage(), $e->getCode(), $e->getPrevious());
throw $e;
}
public function arrayToParams(array $getParams = [], $includeEmpty = true)
+1
View File
@@ -45,6 +45,7 @@ class SimpleRouter
/**
* @throws \Pecee\Http\Exceptions\MalformedUrlException
* @throws HttpException
* @throws \Exception
*/
public static function start()
{