From 057d39bbc1aaaad39f64192cda2cc6dee4b159be Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 21 Jan 2012 10:56:04 +0100 Subject: [PATCH] MDL-31238 always return object for plugin settings from get_config() This prevents multiple creations of objects from NULL which is note a warnings in php54 --- lib/moodlelib.php | 2 +- lib/simpletest/testfilterconfig.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7a8ed9fa971..2e77b0b812f 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1316,7 +1316,7 @@ function get_config($plugin, $name = NULL) { if ($localcfg) { return (object)$localcfg; } else { - return null; + return new stdClass(); } } else { diff --git a/lib/simpletest/testfilterconfig.php b/lib/simpletest/testfilterconfig.php index 28ad2df56f9..98af92b6808 100644 --- a/lib/simpletest/testfilterconfig.php +++ b/lib/simpletest/testfilterconfig.php @@ -747,7 +747,7 @@ class filter_delete_config_test extends UnitTestCaseUsingDatabase { $expectedconfig = new stdClass; $expectedconfig->configname = 'Other config value'; $this->assertEqual($expectedconfig, get_config('filter_other')); - $this->assertNull(get_config('filter_name')); + $this->assertIdentical(get_config('filter_name'), new stdClass()); } public function test_filter_delete_all_for_context() {