Skip to content

Commit e104f78

Browse files
committed
feat(lexicon): better numeric conversion
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent d088894 commit e104f78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/private/Config/ConfigManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ private function migrateUserConfigValue(string $userId, string $appId, ConfigLex
205205
}
206206

207207
public function convertToInt(string $value): int {
208-
if ($value !== ((string)((int)$value))) {
208+
if (!is_numeric($value) || (float)$value <> (int)$value) {
209209
throw new TypeConflictException('Value is not an integer');
210210
}
211211

212212
return (int)$value;
213213
}
214214

215215
public function convertToFloat(string $value): float {
216-
if ($value !== ((string)((float)$value))) {
216+
if (!is_numeric($value)) {
217217
throw new TypeConflictException('Value is not a float');
218218
}
219219

0 commit comments

Comments
 (0)