Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c3097e1
)
get_config / unit tests MDL-24977 get_config('a_plugin'); should return something...
author
Tim Hunt
<T.J.Hunt@open.ac.uk>
Mon, 1 Nov 2010 12:20:39 +0000
(12:20 +0000)
committer
Tim Hunt
<T.J.Hunt@open.ac.uk>
Mon, 1 Nov 2010 12:20:39 +0000
(12:20 +0000)
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
patch
|
blob
|
blame
|
history
diff --git
a/lib/moodlelib.php
b/lib/moodlelib.php
index
efe3ba8
..
9f14f78
100644
(file)
--- 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...