diff --git a/apps/dav/lib/ConfigLexicon.php b/apps/dav/lib/ConfigLexicon.php index 921c6f2036b..8aa6e18fee1 100644 --- a/apps/dav/lib/ConfigLexicon.php +++ b/apps/dav/lib/ConfigLexicon.php @@ -35,6 +35,7 @@ class ConfigLexicon implements ILexicon { defaultRaw: true, definition: 'Whether to not expose the system address book to users', lazy: true, + options: Entry::ENFORCE_VALUE_TYPE ), ]; } diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index be701f3da53..0abd89c74bf 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -478,7 +478,9 @@ class AppConfig implements IAppConfig { ): string { $this->assertParams($app, $key, valueType: $type); $origKey = $key; - $matched = $this->matchAndApplyLexiconDefinition($app, $key, $lazy, $type, $default); + /** @var ?Entry $lexiconEntry */ + $lexiconEntry = null; + $matched = $this->matchAndApplyLexiconDefinition($app, $key, $lazy, $type, $default, $lexiconEntry); if ($default === null) { // there is no logical reason for it to be null throw new \Exception('default cannot be null'); @@ -501,8 +503,12 @@ class AppConfig implements IAppConfig { && $knownType > 0 && !$this->isTyped(self::VALUE_MIXED, $knownType) && !$this->isTyped($type, $knownType)) { - $this->logger->warning('conflict with value type from database', ['app' => $app, 'key' => $key, 'type' => $type, 'knownType' => $knownType]); - throw new AppConfigTypeConflictException('conflict with value type from database'); + if ($lexiconEntry?->hasOption(Entry::ENFORCE_VALUE_TYPE)) { + $this->updateType($app, $key, $lexiconEntry->getValueType()->toAppConfigFlag()); + } else { + $this->logger->warning('conflict with value type from database', ['app' => $app, 'key' => $key, 'type' => $type, 'knownType' => $knownType]); + throw new AppConfigTypeConflictException('conflict with value type from database'); + } } /** diff --git a/lib/public/Config/Lexicon/Entry.php b/lib/public/Config/Lexicon/Entry.php index aa35730c4f1..220e8a7a383 100644 --- a/lib/public/Config/Lexicon/Entry.php +++ b/lib/public/Config/Lexicon/Entry.php @@ -21,7 +21,8 @@ use OCP\Config\ValueType; class Entry { /** @since 32.0.0 */ public const RENAME_INVERT_BOOLEAN = 1; - + /** @since 32.0.0 */ + public const ENFORCE_VALUE_TYPE = 2; private ?string $default = null; /**