diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-10-17 10:59:07 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-10-17 10:59:07 -0400 |
commit | 3543f45c2d4d6e96e5b88c3168075c0d583fc261 (patch) | |
tree | 7f56a1193dacb072d4955f29e9bb1111f6896117 /app/Core/Router.php | |
parent | 8c532efd5f02f7a7e5ea322a07ddcf49d130a8ec (diff) |
Throw exception for page not found
Diffstat (limited to 'app/Core/Router.php')
-rw-r--r-- | app/Core/Router.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/Core/Router.php b/app/Core/Router.php index f4453c71..843f5139 100644 --- a/app/Core/Router.php +++ b/app/Core/Router.php @@ -2,6 +2,8 @@ namespace Kanboard\Core; +use RuntimeException; + /** * Router class * @@ -216,6 +218,10 @@ class Router extends Base $class = '\Kanboard\\'; $class .= empty($plugin) ? 'Controller\\'.ucfirst($this->controller) : 'Plugin\\'.ucfirst($plugin).'\Controller\\'.ucfirst($this->controller); + if (! class_exists($class) || ! method_exists($class, $this->action)) { + throw new RuntimeException('Controller or method not found for the given url!'); + } + $instance = new $class($this->container); $instance->beforeAction($this->controller, $this->action); $instance->{$this->action}(); |