Skip to content

Commit

Permalink
Webservice: Add tolerance for userId null in __getConfiguredUsernameB…
Browse files Browse the repository at this point in the history
…yId() - refs BT#20478
  • Loading branch information
ywarnier committed Feb 17, 2023
1 parent 911ac42 commit 44079ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main/inc/lib/webservices/Rest.php
Expand Up @@ -1204,8 +1204,11 @@ public function getUserProfile(): array
* @param int $userId
* @return string
*/
private function __getConfiguredUsernameById(int $userId): string
private function __getConfiguredUsernameById(int $userId = null): string
{
if (empty($userId)) {
return '';
}
$userField = api_get_configuration_value('webservice_return_user_field');
if (empty($userField)) {
return api_get_user_info($userId)['username'];
Expand Down

0 comments on commit 44079ae

Please sign in to comment.