MDL-53256 cache: Prevent overwriting of cache config with invalid data
authorMichael Aherne <michael.aherne@strath.ac.uk>
Fri, 26 Feb 2016 14:11:40 +0000 (14:11 +0000)
committerMichael Aherne <michael.aherne@strath.ac.uk>
Fri, 1 Apr 2016 07:52:21 +0000 (08:52 +0100)
cache/classes/config.php

index 5fdf2b9..53d0f1e 100644 (file)
@@ -330,7 +330,11 @@ class cache_config {
         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');
         }