More graceful handling in GroupUserUpdateProcessor on invalid configuration

Created on 15 January 2021, almost 4 years ago
Updated 20 March 2023, over 1 year ago

Problem/Motivation

If a user could not be created by the ldap module because the ldap user has no mail property the following errors shows up in the watchdog log

Failed to create Drupal account 'SAMAAccount-Property' because email address could not be derived by LDAP User module

But in the user interface the following error show up on near by every admin site:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\ldap_user\Processor\DrupalUserProcessor::drupalUserLogsIn() must implement interface Drupal\user\UserInterface, null given, called in C:\bin\workspaces\Krzn\310_Dinslaken\m310-www\docroot\modules\contrib\ldap\ldap_user\src\Processor\GroupUserUpdateProcessor.php on line 300 in Drupal\ldap_user\Processor\DrupalUserProcessor->drupalUserLogsIn() (line 449 of modules\contrib\ldap\ldap_user\src\Processor\DrupalUserProcessor.php).
Drupal\ldap_user\Processor\DrupalUserProcessor->drupalUserLogsIn(NULL) (Line: 300)
Drupal\ldap_user\Processor\GroupUserUpdateProcessor->processAccount(Object, 'samaccountname') (Line: 244)
Drupal\ldap_user\Processor\GroupUserUpdateProcessor->runQuery('accounts') (Line: 38)
ldap_user_cron()
call_user_func_array('ldap_user_cron', Array) (Line: 392)
Drupal\Core\Extension\ModuleHandler->invoke('ldap_user', 'cron') (Line: 236)
Drupal\Core\Cron->invokeCronHandlers() (Line: 134)
Drupal\Core\Cron->run() (Line: 75)
Drupal\Core\ProxyClass\Cron->run() (Line: 65)
Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate(Object, 'kernel.terminate', Object)
call_user_func(Array, Object, 'kernel.terminate', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.terminate', Object) (Line: 88)
Symfony\Component\HttpKernel\HttpKernel->terminate(Object, Object) (Line: 32)
Stack\StackedHttpKernel->terminate(Object, Object) (Line: 686)
Drupal\Core\DrupalKernel->terminate(Object, Object) (Line: 22)

Steps to reproduce

  1. Create a User without any mail property in you LDAP
  2. Try to run the cron

Proposed resolution

I think the source have to indentified and a save exit or jump over and log should be considered.

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany sunlix Wesel

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024