Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ public function createSessionToken(IRequest $request, $uid, $loginName, $passwor
// User does not exist
return false;
}
$name = isset($request->server['HTTP_USER_AGENT']) ? $request->server['HTTP_USER_AGENT'] : 'unknown browser';
$name = isset($request->server['HTTP_USER_AGENT']) ? utf8_encode($request->server['HTTP_USER_AGENT']) : 'unknown browser';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utf8_encode is a wrongly named php function, I’d feel better if either we have our own alias named iso-8859-1_to_utf8(), or if we use mb_convert_encoding instead (only possible if we depend upon mbstring).
There are frequent proposal to remove utf8_encode from PHP, all were rejected so far, but it shows this function is confusing.

Copy link
Contributor Author

@Marek-Wojtowicz Marek-Wojtowicz Jan 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there will be time to fix the problem as utf8_encode becomes obsolete. Until then, there may be newer mechanisms that can replace utf8_encode.

try {
$sessionId = $this->session->getId();
$pwd = $this->getPassword($password);
Expand Down