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:
+5
-1
@@ -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...
|
||||
|
||||
Reference in New Issue
Block a user