Deleting user throws type error in loadTokenOnRequestEvent

Created on 3 November 2023, 8 months ago
Updated 18 June 2024, 10 days ago

When cancelling an account, I keep getting this one error on a specific server I've just upgraded to D10:

TypeError: user_login_finalize(): Argument #1 ($account) must be of type Drupal\user\UserInterface, null given, called in /opt/drupal/web/modules/contrib/persistent_login/src/EventSubscriber/TokenHandler.php on line 162 in user_login_finalize() (line 451 of /opt/drupal/web/core/modules/user/user.module).

Annoyingly, I can't seem to reproduce on all servers.

As best I can tell, src/EventSubscriber/TokenHandler::loadTokenOnRequestEvent() doesn't properly react if the $user object loaded is null. There is a try/catch, but it catches PluginException, not TypeError.

I had a look at the 2.1.x branch, it similarly assumes that the retrieved $user will not be null. This might be a bigger issue than the one I'm trying to patch.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada TrevorBradley

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

Comments & Activities

Production build 0.69.0 2024