diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 4ee0dc4e04b4d..c670f878a29eb 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -1173,7 +1173,10 @@ private function setTypedValue( } $oldValue = null; + $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. @@ -1208,6 +1211,7 @@ private function setTypedValue( // TODO: throw exception or just log and returns false !? throw $e; } + $updateReason = 'insert raised a duplicate contraint'; } } @@ -1218,7 +1222,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; } /**