validateCredentialsLoggedIn() triggers a type error in a call to externalauth

Created on 13 July 2023, 12 months ago
Updated 25 July 2023, 11 months ago

Problem/Motivation

The method validateCredentialsLoggedIn() in /ldap_authentication/src/Controller/LoginValidatorLoginForm.php is pulling data from ExternalAuth using the ID of the account, which is processed at that point. The method, which pulls the ID from the account returns a string but the method in ExternalAuth wants an integer. Thus, the following type error is thrown:

TypeError: Drupal\externalauth\Authmap::getAuthData(): Argument #1 ($uid) must be of type int, string given, called in [...]/modules/contrib/ldap/ldap_authentication/src/Controller/LoginValidatorLoginForm.php on line 202 in Drupal\externalauth\Authmap->getAuthData() (line 74 of modules/contrib/externalauth/src/Authmap.php).

Steps to reproduce

  1. Create a normal account without LDAP-binding.
  2. Login with that account.
  3. Edit the account with either changing the password or the e-mail (account name might work too but is disabled on my site).
  4. Save the account.

Proposed resolution

Type-casting the ID to integer helps already, but I'm not sure if it is the cleanest way.

πŸ› Bug report
Status

Closed: duplicate

Version

4.4

Component

Code

Created by

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

Comments & Activities

Production build 0.69.0 2024