Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-03-11 14:34:29 +0300
committerGitHub <noreply@github.com>2020-03-11 14:34:29 +0300
commit92232cd78ee9b8ffb92c422dc28083caeebfed4b (patch)
tree85a6aa695430bf81f296997e9cc1119ddea53541
parent4d6d716692daf0c2a32f58386e3fac4dd4cac98b (diff)
Make sure config cache is only used when there is a correct path (#15687)
-rw-r--r--core/Config/IniFileChain.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/Config/IniFileChain.php b/core/Config/IniFileChain.php
index a3ac25d746..17c7419b4f 100644
--- a/core/Config/IniFileChain.php
+++ b/core/Config/IniFileChain.php
@@ -210,13 +210,16 @@ class IniFileChain
$this->resetSettingsChain($defaultSettingsFiles, $userSettingsFile);
}
- if (!empty($userSettingsFile) && !empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE'])) {
+ $hasAbsoluteConfigFile = !empty($userSettingsFile) && strpos($userSettingsFile, DIRECTORY_SEPARATOR) === 0;
+ $useConfigCache = !empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE']) && $hasAbsoluteConfigFile;
+
+ if ($useConfigCache) {
$cache = new Cache();
$values = $cache->doFetch(self::CONFIG_CACHE_KEY);
if (!empty($values)
&& isset($values['mergedSettings'])
- && isset($values['settingsChain'])) {
+ && isset($values['settingsChain'][$userSettingsFile])) {
$this->mergedSettings = $values['mergedSettings'];
$this->settingsChain = $values['settingsChain'];
return;
@@ -246,8 +249,7 @@ class IniFileChain
$this->mergedSettings = call_user_func($GLOBALS['MATOMO_MODIFY_CONFIG_SETTINGS'], $this->mergedSettings);
}
- if (!empty($GLOBALS['ENABLE_CONFIG_PHP_CACHE'])
- && !empty($userSettingsFile)
+ if ($useConfigCache
&& !empty($this->mergedSettings)
&& !empty($this->settingsChain)) {