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.
This commit is contained in:
Tim Hunt 2010-11-01 12:20:39 +00:00
parent c3097e1333
commit bfb82da3e4

View File

@ -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...