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

skuark created an issue. See original summary.

  • queenvictoria committed 2b0a908 on 8.x-3.x
    Issue #2774305: Ldap Authentication: Call to undefined function config
    
queenvictoria’s picture

Status: Active » Fixed

Added 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.