Skip to content

Commit f71bb7d

Browse files
committed
fix test
Signed-off-by: Maxence Lange <[email protected]>
1 parent e510535 commit f71bb7d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/private/AllConfig.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,12 @@ public function getUserValue($userId, $appName, $key, $default = '') {
261261
if ($userId === null || $userId === '') {
262262
return $default;
263263
}
264-
return \OC::$server->get(UserPreferences::class)->getValueMixed($userId, $appName, $key, $default);
264+
$userPrefs = \OC::$server->get(UserPreferences::class);
265+
// because $default can be null ...
266+
if (!$userPrefs->hasKey($userId, $appName, $key)) {
267+
return $default;
268+
}
269+
return \OC::$server->get(UserPreferences::class)->getValueMixed($userId, $appName, $key, $default ?? '');
265270
}
266271

267272
/**

lib/private/UserPreferences.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public function getValueMixed(
454454
string $key,
455455
string $default = '',
456456
?bool $lazy = false
457-
): ?string {
457+
): string {
458458
try {
459459
$lazy = ($lazy === null) ? $this->isLazy($userId, $app, $key) : $lazy;
460460
} catch (UnknownKeyException) {
@@ -465,7 +465,7 @@ public function getValueMixed(
465465
$userId,
466466
$app,
467467
$key,
468-
$default ?? '',
468+
$default,
469469
$lazy,
470470
ValueType::MIXED
471471
);

0 commit comments

Comments
 (0)