Skip to content

Commit 45fcdf1

Browse files
committed
fix(Settings): do not fail badly on unknown keys
This may happen with left over settings when switching from built-in SAML mode to env-mode, for example. (Or with some development left overs/temporary unknown keys when switching branches) Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
1 parent 63bff68 commit 45fcdf1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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)