Skip to content

Commit

Permalink
MDL-70137 cache: Use sensible default when reading MUC config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewnicols authored and vmdef committed Nov 6, 2020
1 parent ea32d65 commit db8377b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cache/classes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function get_site_identifier() {
* @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();

Expand Down Expand Up @@ -594,4 +594,4 @@ public function get_default_lock() {
}
throw new cache_exception('ex_nodefaultlock');
}
}
}

0 comments on commit db8377b

Please sign in to comment.