diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index d746a6950865e..473b8f3364d99 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -1141,7 +1141,10 @@ private function setTypedValue( } } + $updateReason = ''; if ($this->hasKey($userId, $app, $key, $lazy)) { + $updateReason = 'key exists'; + /** * no update if key is already known with set lazy status and value is * not different, unless sensitivity is switched from false to true. @@ -1175,6 +1178,7 @@ private function setTypedValue( // TODO: throw exception or just log and returns false !? throw $e; } + $updateReason = 'insert raised a duplicate contraint'; } } @@ -1185,7 +1189,11 @@ private function setTypedValue( $currType = $this->valueDetails[$userId][$app][$key]['type'] ?? null; if ($currType === null) { // this might happen when switching lazy loading status $this->loadConfigAll($userId); - $currType = $this->valueDetails[$userId][$app][$key]['type']; + + if (!isset($this->valueDetails[$userId][$app][$key])) { + throw new UnknownKeyException("unknown key $app $key for $userId even though $updateReason"); + } + $currType = $this->valueDetails[$userId][$app][$key]['type'] ?? null; } /**