Skip to content

Commit 6447803

Browse files
authored
Merge pull request #955 from nextcloud/fix/noid/exception-on-settings-key
fix(Settings): do not fail badly on unknown keys
2 parents 1d2f999 + 45fcdf1 commit 6447803

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lib/SAMLSettings.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,9 @@ public function get(int $id): array {
197197
* @throws InvalidArgumentException
198198
*/
199199
public function set(int $id, array $settings): void {
200-
foreach (array_keys($settings) as $configKey) {
201-
if (!in_array($configKey, self::IDP_CONFIG_KEYS)) {
202-
throw new InvalidArgumentException('Invalid config key');
203-
}
204-
}
200+
$settings = array_filter($settings, static function (string $configKey): bool {
201+
return in_array($configKey, self::IDP_CONFIG_KEYS, true);
202+
}, ARRAY_FILTER_USE_KEY);
205203

206204
$this->mapper->set($id, $settings);
207205
}

0 commit comments

Comments
 (0)