From ad23f18a4011721e6371302594477f244e2e2aab Mon Sep 17 00:00:00 2001 From: Michael Aherne Date: Fri, 26 Feb 2016 14:11:40 +0000 Subject: [PATCH] MDL-53256 cache: Prevent overwriting of cache config with invalid data --- cache/classes/config.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cache/classes/config.php b/cache/classes/config.php index 5fdf2b95cd36e..53d0f1e178e30 100644 --- a/cache/classes/config.php +++ b/cache/classes/config.php @@ -330,7 +330,11 @@ protected function include_configuration() { if (!file_exists($cachefile)) { throw new cache_exception('Default cache config could not be found. It should have already been created by now.'); } - include($cachefile); + + if (!include($cachefile)) { + throw new cache_exception('Unable to load the cache configuration file'); + } + if (!is_array($configuration)) { throw new cache_exception('Invalid cache configuration file'); }