Make sure the array exists

This commit is contained in:
Joas Schilling 2015-09-03 15:41:30 +02:00
parent 21ba3b8737
commit 38a164aa7a
1 changed files with 8 additions and 0 deletions

View File

@ -161,6 +161,10 @@ class AppConfig implements IAppConfig {
]); ]);
if ($inserted) { if ($inserted) {
if (!isset($this->cache[$app])) {
$this->cache[$app] = [];
}
$this->cache[$app][$key] = $value; $this->cache[$app][$key] = $value;
return true; return true;
} }
@ -264,6 +268,10 @@ class AppConfig implements IAppConfig {
$result = $sql->execute(); $result = $sql->execute();
while ($row = $result->fetch()) { while ($row = $result->fetch()) {
if (!isset($this->cache[$row['appid']])) {
$this->cache[$row['appid']] = [];
}
$this->cache[$row['appid']][$row['configkey']] = $row['configvalue']; $this->cache[$row['appid']][$row['configkey']] = $row['configvalue'];
} }
$result->closeCursor(); $result->closeCursor();