From 41e8a4a876916e5ad7c73e7e526584f24516e805 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 16 Sep 2014 12:57:18 +0000 Subject: [PATCH] route : Return to standard class : not not needed static git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1824 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- route.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; }