From db8377b53e2d2fde48e1011a5600fec6eb57fe3b Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Nov 2020 15:27:46 +0800 Subject: [PATCH] MDL-70137 cache: Use sensible default when reading MUC config When we read the MUC configuration, a file which exists but is empty will not error, but will cause all configuration to be empty. We already perform an {{is_array()}} check on the {{$configuration}} variable, but the default value for {{$configuration}} is an empty array. In the case where the file exists, but is empty, no errors occur when the file is loaded, and the initial {{$configuration}} value is not overwritten, leading to the file being replaced with an empty copy. --- cache/classes/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/classes/config.php b/cache/classes/config.php index 53d0f1e178e..021e2a69dd9 100644 --- a/cache/classes/config.php +++ b/cache/classes/config.php @@ -323,7 +323,7 @@ class cache_config { * @throws cache_exception */ protected function include_configuration() { - $configuration = array(); + $configuration = null; // We need to allow for late static bindings to allow for class path mudling happending for unit tests. $cachefile = static::get_config_file_path(); @@ -594,4 +594,4 @@ class cache_config { } throw new cache_exception('ex_nodefaultlock'); } -} \ No newline at end of file +}