diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2021-10-23 10:52:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-23 10:52:44 +0200 |
commit | 7e117da4357cda049bc41c1e146e1b0f8a06ddee (patch) | |
tree | de58e7b3007cb52738468b0eba3f5327ae1c3655 /lib | |
parent | 811670a3adc4a253fd33dba2df5693e50e30ef23 (diff) | |
parent | e26d6f080ba978fb4c40b7caf190714a67e2e80c (diff) | |
download | nextcloud-server-7e117da4357cda049bc41c1e146e1b0f8a06ddee.tar.gz nextcloud-server-7e117da4357cda049bc41c1e146e1b0f8a06ddee.zip |
Merge pull request #29397 from nextcloud/fix/noid/profile-missing-def-values
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Accounts/AccountManager.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 3416db56ba5..cbd51e71c4a 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -473,15 +473,16 @@ class AccountManager implements IAccountManager { * Make sure that all expected data are set */ protected function addMissingDefaultValues(array $userData, array $defaultUserData): array { - foreach ($defaultUserData as $i => $value) { - // If property doesn't exists, initialize it - if (!array_key_exists($i, $userData)) { - $userData[$i] = []; + foreach ($defaultUserData as $defaultDataItem) { + // If property does not exist, initialize it + $userDataIndex = array_search($defaultDataItem['name'], array_column($userData, 'name')); + if ($userDataIndex === false) { + $userData[] = $defaultDataItem; + continue; } // Merge and extend default missing values - $defaultValueIndex = array_search($value['name'], array_column($defaultUserData, 'name')); - $userData[$i] = array_merge($defaultUserData[$defaultValueIndex], $userData[$i]); + $userData[$userDataIndex] = array_merge($defaultDataItem, $userData[$userDataIndex]); } return $userData; |