All OIDC names can be returned in openid_connect_user_format_name_alter

Created on 11 May 2022, almost 3 years ago
Updated 31 March 2025, 5 days ago

Problem/Motivation

For an unsaved user entity, $account->getDisplayName() is returning an array of all oidc names. From a type standpoint, that function is supposed to return a string or MarkupInterface. From a functionality standpoint, it's not working as expected.

Steps to reproduce

1. Enable the module (I am on 2.0.0-alpha12) and configure an OIDC client
2. Log in via the client at least once
3. Implement hook_ENTITY_TYPE_presave for the user entity type, and use logger/messenger/devel/etc to dump/export $account->getDisplayName().
4. Create a new user; notice that the debug you added shows an array containing all OIDC names.

Proposed resolution

Early exit if $account->id() is empty (indicating anonymous user or unsaved entity); I don't think the module is intending or has need to intervene in either case.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024