diff --git a/route.php b/route.php index 2b35f6d..15bacdc 100644 --- a/route.php +++ b/route.php @@ -21,7 +21,7 @@ class route public $debug=0; //public $defaultOutput = "html"; // Default renderer : html - // Provide the static class::method to errors in routing. + // Provide the the class catch errors in routing. // Must be provided in an array(class,method); public $errors = null; @@ -606,11 +606,17 @@ class route // If an error class/method is defined, use it in place of the default // one. - // The error method must be a "static public function" - // The errors must be defined in an array ("class", "method"); + // The errors must be defined in an array("class", "method"); if ($this->errors !== null) { - forward_static_call($this->errors, $getCode, $e->getMessage()); + if (! is_array ($this->errors)) + die ("The route::\$errors is not an array\n"); + if (! isset ($this->errors[0]) || ! isset ($this->errors[1])) + die ("The route::\$errors is not correct : must be the class and ". + "the method in an array\n"); + $a = new $this->errors[0]; + $method = $this->errors[1]; + $a->$method ($getCode, $e->getMessage()); exit; }