aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2025-06-17 19:02:08 +0200
committerMaxence Lange <maxence@artificial-owl.com>2025-06-19 11:04:11 +0200
commit1b42dad8f3863e4c9d602340d0109bffdc8e9bfd (patch)
treefbb3c7a1ad827aec557b64465b5e2c5213ca0348
parent6bba89aa2ad3c8e14e72dd560af0e14924116f3c (diff)
downloadnextcloud-server-feat/noid/lexicon-migrate-keys.tar.gz
nextcloud-server-feat/noid/lexicon-migrate-keys.zip
feat(lexicon): better numeric conversionfeat/noid/lexicon-migrate-keys
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--lib/private/AppConfig.php1
-rw-r--r--lib/private/Config/ConfigManager.php4
-rw-r--r--lib/private/Config/UserConfig.php1
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php
index 4048e32cca1..b6412b410bb 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -480,6 +480,7 @@ class AppConfig implements IAppConfig {
// in case the key was modified while running matchAndApplyLexiconDefinition() we are
// interested to check options in case a modification of the value is needed
+ // ie inverting value from previous key when using lexicon option RENAME_INVERT_BOOLEAN
if ($origKey !== $key && $type === self::VALUE_BOOL) {
$configManager = Server::get(ConfigManager::class);
$value = ($configManager->convertToBool($value, $this->getLexiconEntry($app, $key))) ? '1' : '0';
diff --git a/lib/private/Config/ConfigManager.php b/lib/private/Config/ConfigManager.php
index 08deb4c84d3..1980269e2ca 100644
--- a/lib/private/Config/ConfigManager.php
+++ b/lib/private/Config/ConfigManager.php
@@ -205,7 +205,7 @@ class ConfigManager {
}
public function convertToInt(string $value): int {
- if ($value !== ((string)((int)$value))) {
+ if (!is_numeric($value) || (float)$value <> (int)$value) {
throw new TypeConflictException('Value is not an integer');
}
@@ -213,7 +213,7 @@ class ConfigManager {
}
public function convertToFloat(string $value): float {
- if ($value !== ((string)((float)$value))) {
+ if (!is_numeric($value)) {
throw new TypeConflictException('Value is not a float');
}
diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php
index 59d6439b3bd..7a49a932737 100644
--- a/lib/private/Config/UserConfig.php
+++ b/lib/private/Config/UserConfig.php
@@ -760,6 +760,7 @@ class UserConfig implements IUserConfig {
// in case the key was modified while running matchAndApplyLexiconDefinition() we are
// interested to check options in case a modification of the value is needed
+ // ie inverting value from previous key when using lexicon option RENAME_INVERT_BOOLEAN
if ($origKey !== $key && $type === ValueType::BOOL) {
$configManager = Server::get(ConfigManager::class);
$value = ($configManager->convertToBool($value, $this->getLexiconEntry($app, $key))) ? '1' : '0';