Skip to content

Commit 4156ece

Browse files
committed
Fixed undefined array in classes/cache_factory.php
1 parent a8ee9d6 commit 4156ece

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

classes/cache_factory.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,21 @@ public function create_config_instance($writer = false) {
5353
}
5454
}
5555

56+
$config = null;
57+
5658
if (!array_key_exists($class, $this->configs)) {
5759
// Create a new instance and call it to load it.
5860
// As part of generating store instance config we test the initialisation of stores.
5961
// Testing this may initialise DI, which will attempt to use cache for hookcallbacks.
6062
// Setting the state to initialising will make it use ad-hoc cache for that request.
6163
self::set_state(self::STATE_INITIALISING);
62-
$this->configs[$class] = new $class;
63-
$this->configs[$class]->load();
64+
$config = new $class;
65+
$config->load();
66+
67+
// Re-register after load in case anything reset $this->configs.
68+
$this->configs[$class] = $config;
69+
} else {
70+
$config = $this->configs[$class];
6471
}
6572

6673
// We need the siteid in order to use the caches, but the siteid
@@ -77,7 +84,7 @@ public function create_config_instance($writer = false) {
7784
}
7885

7986
// Return the instance.
80-
return $this->configs[$class];
87+
return $config;
8188
}
8289

8390
/**

0 commit comments

Comments
 (0)