User_Ldap module crush login Nextcloud

Nextcloud version : 20.0.7
Operating system and version : Ubuntu 20.04
Apache or nginx version : Apache/2.4.41
PHP version : PHP 7.4.15

The issue you are facing:
The bug appeared on version 19.0.7
The server still needed to be changed, so I installed a completely new system and transferred the data to it.
Error moved with data.
When updating data on a new server, an error occurred due to the user_ldap module, I disabled it and the system started working.
When the module is enabled, I cannot log into the server itself, even with local credentials.

Is this the first time you’ve seen this error? : Y

Steps to replicate it:

  1. I tried to change the version PHP
  2. Read this forum and tried solutions for similar problems.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"GeHvpot7HopE5Uukx3Qu","level":3,"time":"2021-02-12T12:05:22+00:00","remoteAddr":"213.33.183.106","user":"af","app":"index","method":"GET","url":"/settings/user","message":{"Exception":"Exception","Message":"LDAP Operations error","Code":1,"Trace":[{"file":"/var/www/nextcloud/apps/user_ldap/lib/LDAP.php","line":420,"function":"processLDAPError","class":"OCA\\User_LDAP\\LDAP","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/LDAP.php","line":343,"function":"postFunctionCall","class":"OCA\\User_LDAP\\LDAP","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/LDAP.php","line":234,"function":"invokeLDAPMethod","class":"OCA\\User_LDAP\\LDAP","type":"->","args":["*** sensitive parameters replaced ***"]},{"function":"search","class":"OCA\\User_LDAP\\LDAP","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/Access.php","line":1094,"function":"call_user_func_array"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/Access.php","line":1098,"function":"OCA\\User_LDAP\\{closure}","class":"OCA\\User_LDAP\\Access","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/user_ldap/lib/Access.php","line":1151,"function":"invokeLDAPMethod","class":"OCA\\User_LDAP\\Access","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/apps/user_ldap/lib/Access.php","line":1256,"function":"executeSearch","class":"OCA\\User_LDAP\\Access","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/Access.php","line":1007,"function":"count","class":"OCA\\User_LDAP\\Access","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/User_LDAP.php","line":565,"function":"countUsers","class":"OCA\\User_LDAP\\Access","type":"->"},{"file":"/var/www/nextcloud/apps/user_ldap/lib/User_Proxy.php","line":358,"function":"countUsers","class":"OCA\\User_LDAP\\User_LDAP","type":"->"},{"file":"/var/www/nextcloud/apps/support/lib/Service/SubscriptionService.php","line":128,"function":"countUsers","class":"OCA\\User_LDAP\\User_Proxy","type":"->"},{"file":"/var/www/nextcloud/apps/support/lib/Service/SubscriptionService.php","line":270,"function":"getUserCount","class":"OCA\\Support\\Service\\SubscriptionService","type":"->"},{"file":"/var/www/nextcloud/apps/support/lib/Subscription/SubscriptionAdapter.php","line":51,"function":"getSubscriptionInfo","class":"OCA\\Support\\Service\\SubscriptionService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Support/Subscription/Registry.php","line":141,"function":"hasValidSubscription","class":"OCA\\Support\\Subscription\\SubscriptionAdapter","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Settings/Personal/ServerDevNotice.php","line":103,"function":"delegateHasValidSubscription","class":"OC\\Support\\Subscription\\Registry","type":"->"},{"file":"/var/www/nextcloud/lib/private/Settings/Manager.php","line":190,"function":"getSection","class":"OCA\\Settings\\Settings\\Personal\\ServerDevNotice","type":"->"},{"file":"/var/www/nextcloud/lib/private/Settings/Manager.php","line":304,"function":"getSettings","class":"OC\\Settings\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Settings/Manager.php","line":265,"function":"getPersonalSettings","class":"OC\\Settings\\Manager","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":119,"function":"getPersonalSections","class":"OC\\Settings\\Manager","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":64,"function":"formatPersonalSections","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":151,"function":"getNavigationParameters","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/PersonalSettingsController.php","line":68,"function":"getIndexResponse","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"index","class":"OCA\\Settings\\Controller\\PersonalSettingsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":37,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/user_ldap/lib/LDAP.php","Line":387,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36","version":"20.0.7.1","id":"602676789eebc"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):


<?php
$CONFIG = array (
  'instanceid' => 'remove',
  'passwordsalt' => 'remove',
  'secret' => 'remove',
  'trusted_domains' =>
  array (
    0 => 'remove',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '20.0.7.1',
  'overwrite.cli.url' => 'remove',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'remove',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'remove',
  'mail_smtphost' => '10.100.0.4',
  'mail_smtpport' => '25',
  'ldapIgnoreNamingRules' => false,
);


sudo -u www-data php occ app:check-code user_ldap:

Analysing /var/www/nextcloud/apps/user_ldap/lib/Access.php
 14 errors
    line  189: OCP\Util::writeLog - Method of deprecated class must not be called
    line  197: OCP\Util::writeLog - Method of deprecated class must not be called
    line  252: OCP\Util::writeLog - Method of deprecated class must not be called
    line  276: OCP\Util::writeLog - Method of deprecated class must not be called
    line  282: OCP\Util::writeLog - Method of deprecated class must not be called
    line  368: OCP\Util::writeLog - Method of deprecated class must not be called
    line  542: OCP\Util::writeLog - Method of deprecated class must not be called
    line  549: OCP\Util::writeLog - Method of deprecated class must not be called
    line  608: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1091: == - is discouraged
    line 1104: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1110: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1144: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1155: OCP\Util::writeLog - Method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/FilesystemHelper.php
 1 errors
    line   45: OC_Util - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/Connection.php
 12 errors
    line  212: OCP\Util::writeLog - Method of deprecated class must not be called
    line  384: OCP\Util::writeLog - Method of deprecated class must not be called
    line  410: OCP\Util::writeLog - Method of deprecated class must not be called
    line  453: OCP\Util::writeLog - Method of deprecated class must not be called
    line  468: OCP\Util::writeLog - Method of deprecated class must not be called
    line  481: OCP\Util::writeLog - Method of deprecated class must not be called
    line  491: OCP\Util::writeLog - Method of deprecated class must not be called
    line  538: OCP\Util::writeLog - Method of deprecated class must not be called
    line  548: OCP\Util::writeLog - Method of deprecated class must not be called
    line  558: OCP\Util::writeLog - Method of deprecated class must not be called
    line  562: OCP\Util::writeLog - Method of deprecated class must not be called
    line  675: OCP\Util::writeLog - Method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/AppInfo/Application.php
 1 errors
    line  111: OC_User - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/Wizard.php
 8 errors
    line  304: OCP\Util::writeLog - Method of deprecated class must not be called
    line  684: OCP\Util::writeLog - Method of deprecated class must not be called
    line  707: OCP\Util::writeLog - Method of deprecated class must not be called
    line  852: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1029: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1049: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1068: OCP\Util::writeLog - Method of deprecated class must not be called
    line 1083: OCP\Util::writeLog - Method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/Jobs/UpdateGroups.php
 17 errors
    line   69: OCP\Util::writeLog - Method of deprecated class must not be called
    line   75: OCP\Util::writeLog - Method of deprecated class must not be called
    line   85: OCP\Util::writeLog - Method of deprecated class must not be called
    line  105: OCP\Util::writeLog - Method of deprecated class must not be called
    line  106: OC_DB - Static method of private class must not be called
    line  123: OCP\Util::writeLog - Method of deprecated class must not be called
    line  133: OCP\Util::writeLog - Method of deprecated class must not be called
    line  142: OCP\Util::writeLog - Method of deprecated class must not be called
    line  151: OCP\Util::writeLog - Method of deprecated class must not be called
    line  152: OC_DB - Static method of private class must not be called
    line  158: OCP\Util::writeLog - Method of deprecated class must not be called
    line  164: OCP\Util::writeLog - Method of deprecated class must not be called
    line  173: OCP\Util::writeLog - Method of deprecated class must not be called
    line  174: OC_DB - Static method of private class must not be called
    line  180: OCP\Util::writeLog - Method of deprecated class must not be called
    line  185: OCP\Util::writeLog - Method of deprecated class must not be called
    line  233: OC_DB - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/Group_LDAP.php
 2 errors
    line  348: != - is discouraged
    line 1222: != - is discouraged
Analysing /var/www/nextcloud/apps/user_ldap/lib/User_LDAP.php
 4 errors
    line  183: Util::writeLog - Method of deprecated class must not be called
    line  269: Util::writeLog - Method of deprecated class must not be called
    line  278: Util::writeLog - Method of deprecated class must not be called
    line  356: Util::writeLog - Method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/UserPluginManager.php
 1 errors
    line   80: == - is discouraged
Analysing /var/www/nextcloud/apps/user_ldap/lib/Controller/RenewPasswordController.php
 1 errors
    line  145: OC_User - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/Helper.php
 1 errors
    line  168: OC_DB - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/User/User.php
 1 errors
    line  522: OC_Helper - Static method of private class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/LogWrapper.php
 1 errors
    line   38: OCP\Util::writeLog - Method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/lib/GroupPluginManager.php
 1 errors
    line   70: == - is discouraged
Analysing /var/www/nextcloud/apps/user_ldap/ajax/wizard.php
 15 errors
    line   33: OC_JSON - Static method of deprecated class must not be called
    line   34: OC_JSON - Static method of deprecated class must not be called
    line   35: OC_JSON - Static method of deprecated class must not be called
    line   40: OC_JSON - Static method of deprecated class must not be called
    line   46: OC_JSON - Static method of deprecated class must not be called
    line   99: OC_JSON - Static method of deprecated class must not be called
    line  103: OC_JSON - Static method of deprecated class must not be called
    line  106: OC_JSON - Static method of deprecated class must not be called
    line  115: OC_JSON - Static method of deprecated class must not be called
    line  119: OC_JSON - Static method of deprecated class must not be called
    line  122: OC_JSON - Static method of deprecated class must not be called
    line  131: OC_JSON - Static method of deprecated class must not be called
    line  138: OC_JSON - Static method of deprecated class must not be called
    line  146: OC_JSON - Static method of deprecated class must not be called
    line  149: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/getNewServerConfigPrefix.php
 4 errors
    line   28: OC_JSON - Static method of deprecated class must not be called
    line   29: OC_JSON - Static method of deprecated class must not be called
    line   30: OC_JSON - Static method of deprecated class must not be called
    line   52: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/deleteConfiguration.php
 5 errors
    line   30: OC_JSON - Static method of deprecated class must not be called
    line   31: OC_JSON - Static method of deprecated class must not be called
    line   32: OC_JSON - Static method of deprecated class must not be called
    line   37: OC_JSON - Static method of deprecated class must not be called
    line   40: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/testConfiguration.php
 8 errors
    line   31: OC_JSON - Static method of deprecated class must not be called
    line   32: OC_JSON - Static method of deprecated class must not be called
    line   33: OC_JSON - Static method of deprecated class must not be called
    line   72: OC_JSON - Static method of deprecated class must not be called
    line   76: OC_JSON - Static method of deprecated class must not be called
    line   79: OC_JSON - Static method of deprecated class must not be called
    line   83: OC_JSON - Static method of deprecated class must not be called
    line   87: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/getConfiguration.php
 4 errors
    line   30: OC_JSON - Static method of deprecated class must not be called
    line   31: OC_JSON - Static method of deprecated class must not be called
    line   32: OC_JSON - Static method of deprecated class must not be called
    line   42: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/setConfiguration.php
 4 errors
    line   29: OC_JSON - Static method of deprecated class must not be called
    line   30: OC_JSON - Static method of deprecated class must not be called
    line   31: OC_JSON - Static method of deprecated class must not be called
    line   50: OC_JSON - Static method of deprecated class must not be called
Analysing /var/www/nextcloud/apps/user_ldap/ajax/clearMappings.php
 5 errors
    line   32: OC_JSON - Static method of deprecated class must not be called
    line   33: OC_JSON - Static method of deprecated class must not be called
    line   34: OC_JSON - Static method of deprecated class must not be called
    line   58: OC_JSON - Static method of deprecated class must not be called
    line   60: OC_JSON - Static method of deprecated class must not be called
Deprecated file found: /var/www/nextcloud/apps/user_ldap/appinfo/update.php - please use repair steps
App is not compliant