From 0f2addf5e4e049558dea37f623d77f0d3eea134d Mon Sep 17 00:00:00 2001 From: Bogdan Raica Date: Fri, 5 May 2017 21:25:02 +0300 Subject: [PATCH] Avoid methods that are not callable Avoid issues when someone tries to access a protected / private method which would not work. --- application/Core/Application.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/Core/Application.php b/application/Core/Application.php index f6976ed..b5235bb 100644 --- a/application/Core/Application.php +++ b/application/Core/Application.php @@ -37,8 +37,9 @@ public function __construct() $this->url_controller = new $controller(); // check for method: does such a method exist in the controller ? - if (method_exists($this->url_controller, $this->url_action)) { - + if (method_exists($this->url_controller, $this->url_action) && + is_callable(array($this->url_controller, $this->url_action))) { + if (!empty($this->url_params)) { // Call the method and pass arguments to it call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);