From 4e7397ddc704c4ac011222bf6d692320666e0a9e Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 18 Jan 2012 02:09:46 +0100 Subject: [PATCH] MDL-31006 revert partially @ get_config() The change from null to stdClass() in get_config() was leading to: 1) unit tests not passing. 2) non-equivalent evaluation in conditions (null evals false, stdClassi() evals true) --- 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 cd4480fc88a..cb3f00e3323 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1076,7 +1076,7 @@ function get_config($plugin, $name = NULL) { if ($localcfg) { return (object)$localcfg; } else { - return new stdClass(); + return null; } } else { diff --git a/lib/simpletest/testfilterconfig.php b/lib/simpletest/testfilterconfig.php index ccd3592700e..9f769cc0788 100644 --- a/lib/simpletest/testfilterconfig.php +++ b/lib/simpletest/testfilterconfig.php @@ -579,7 +579,7 @@ class filter_delete_config_test extends UnitTestCaseUsingDatabase { $expectedconfig = new stdClass; $expectedconfig->configname = 'Other config value'; $this->assertEqual($expectedconfig, get_config('filter_other')); - $this->assertFalse(get_config('filter_name')); + $this->assertNull(get_config('filter_name')); } public function test_filter_delete_all_for_context() { -- 2.11.4.GIT