Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Login in with a non-existing drupal account, I obtain that error on watchdog:
Error: Call to undefined function config() in _ldap_authentication_user_login_authenticate_validate() (line 328 of [...]/modules/contrib/ldap/ldap_authentication/ldap_authentication.inc)
The code in that line:
if ($auth_conf->ldapUser->acctCreation == LDAP_AUTHENTICATION_ACCT_CREATION_USER_SETTINGS_FOR_LDAP &&
config('user.settings')->get('register') == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) {
It seems that the issue is solved adding \Drupal::
before config('user.settings')
:
if ($auth_conf->ldapUser->acctCreation == LDAP_AUTHENTICATION_ACCT_CREATION_USER_SETTINGS_FOR_LDAP &&
\Drupal::config('user.settings')->get('register') == USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) {
Comments
Comment #3
queenvictoria CreditAttribution: queenvictoria at Holly commentedAdded thanks! I also correct another instance of
config()
to\Drupal::config()
in the same file.In future it would be good to provide details on your configuration and test pattern so that we can easily test the fix before applying it.