From 98984c09a2c1dc993516b79873cecc3df94ffd42 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 6 Jun 2012 19:57:47 +0100 Subject: [PATCH] MDL-33565 setuplib: better error if you pass an object as $debuginfo This changes makes sure the error is triggerd when the exception is thrown, so that the problem code is in the stack-trace. Before, the error happend in the exception hander, so you could not see the code that caused the problem. --- lib/setuplib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/setuplib.php b/lib/setuplib.php index 2c471f67d2b..4fec92df14e 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -133,7 +133,7 @@ class moodle_exception extends Exception { $this->module = $module; $this->link = $link; $this->a = $a; - $this->debuginfo = $debuginfo; + $this->debuginfo = is_null($debuginfo) ? null : (string)$debuginfo; if (get_string_manager()->string_exists($errorcode, $module)) { $message = get_string($errorcode, $module, $a); @@ -486,7 +486,7 @@ function get_exception_info($ex) { $module = 'error'; $a = $ex->getMessage(); $link = ''; - $debuginfo = null; + $debuginfo = ''; } // Append the error code to the debug info to make grepping and googling easier