Deleting user throws type error in loadTokenOnRequestEvent

Created on 3 November 2023, about 1 year 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.71.5 2024