From bfb82da3e47861bc497a8a7863792b935ed4f71b Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 1 Nov 2010 12:20:39 +0000 Subject: [PATCH] get_config / unit tests MDL-24977 get_config('a_plugin'); should return something false when there is no config. It was always casting the result to an object, even when it was an empty array. I changed it to return null in this case. So that if (get_config('a_plugin')) { /* Do something relying on the pugin having config */ ) works. --- lib/moodlelib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index efe3ba89cdc..9f14f78c438 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1046,7 +1046,11 @@ function get_config($plugin, $name = NULL) { } } } - return (object)$localcfg; + if ($localcfg) { + return (object)$localcfg; + } else { + return null; + } } else { // this part is not really used any more, but anyway...