I 'm having a problem since updating to Drupal 9, with regards to LDAP integration. Previously, while on Drupal 8, I had successfully integrated my schools LDAP for users authentication, using the appropriate contrib module. However, after updating to Drupal 9, LDAP integration has stopped functioning, and whenever a user tries to login, they get a white screen error "The website encountered an unexpected error. Please try again later."

Now, checking the logs, I always see this error:

    Error: Class 'Symfony\Component\OptionsResolver\OptionsResolver' not found in Symfony\Component\Ldap\Adapter\AbstractConnection->__construct() (line 26 of /var/www/www-dev/modules/ludwig/lib/grahl-ldap/source/Adapter/AbstractConnection.php)
#0 /var/www/www-dev/modules/ludwig/lib/grahl-ldap/source/Adapter/ExtLdap/Adapter.php(41): Symfony\Component\Ldap\Adapter\AbstractConnection->__construct()
#1 /var/www/www-dev/modules/ludwig/lib/grahl-ldap/source/Ldap.php(40): Symfony\Component\Ldap\Adapter\ExtLdap\Adapter->getConnection()
#2 /var/www/www-dev/modules/ldap/ldap_servers/src/LdapBridge.php(143): Symfony\Component\Ldap\Ldap->bind()
#3 /var/www/www-dev/modules/ldap/ldap_servers/src/ServerListBuilder.php(92): Drupal\ldap_servers\LdapBridge->bind()
#4 /var/www/www-dev/modules/ldap/ldap_servers/src/ServerListBuilder.php(58): Drupal\ldap_servers\ServerListBuilder->checkStatus()
#5 /var/www/www-dev/core/lib/Drupal/Core/Entity/EntityListBuilder.php(219): Drupal\ldap_servers\ServerListBuilder->buildRow()
#6 /var/www/www-dev/core/lib/Drupal/Core/Entity/Controller/EntityListController.php(23): Drupal\Core\Entity\EntityListBuilder->render()
#7 [internal function]: Drupal\Core\Entity\Controller\EntityListController->listing()
#8 /var/www/www-dev/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#9 /var/www/www-dev/core/lib/Drupal/Core/Render/Renderer.php(578): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/www/www-dev/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#11 /var/www/www-dev/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#12 /var/www/www-dev/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /var/www/www-dev/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#14 /var/www/www-dev/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#15 /var/www/www-dev/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#16 /var/www/www-dev/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#17 /var/www/www-dev/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#18 /var/www/www-dev/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#19 /var/www/www-dev/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#20 /var/www/www-dev/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#21 /var/www/www-dev/core/lib/Drupal/Core/DrupalKernel.php(717): Stack\StackedHttpKernel->handle()
#22 /var/www/www-dev/index.php(19): Drupal\Core\DrupalKernel->handle()
#23 {main}

Now, it's important to note, that I am not maintaining the site through Composer - it was installed prior to composer being the default solution for installing/updating. Hence, I update core and modules manually.

I have successfully used a very useful module - Ludwig - which is a Composer alternative for contrib modules that require external PHP libraries.

Indeed, ludwig seems to find the external libraries needed for LDAP, see the screenshot (and that's where the error is coming from, the grahl/ldap lib).

ludwig finds necessary packages

Now, I did search for the grahl/ldap package and documentation and it does list a library called options-resolver as a requirement.

I did search the vendor/symfony listing on my web server, and although I see several libraries (such as the polyfill-php80 which is another requirement of grahl/ldap), i do not see that options-resolver lib.

I did try to manually download the files (ran composer require symfony/options-resolver in a new arbitrary directory, saw what it fetched, and copied the contents of the options-resolver folder into vendor/symfony). However, I am not surprised that the error continues, it cannot find the class OptionsResolver.php, even though it "exists" where it should be (?). I suspect it keeps a registry of what exists - it doesn't simply check the path and looks for a file ....

It might sound stupid, but I 'm completely in the dark here - I am obviously not very experienced in all this ..

I would really be grateful if someone could provide a hint .. Sorry for writing an over-detailed question, I just wanted to provide as much information as possible ..

Should I install options-resolver through Composer although I haven't used it so far to install/update previously?

Any help would be greatly appreciated ..

  • With manual downloading I'm guessing the autoloader Composer normally generates is not updated, so the namespaces are not resolved to the files in vendor.
    – Kevin
    Jan 12, 2022 at 12:58
  • a bit late, but appreciate your input buddy .. I guessed it must have been something like this. I can't solve it, but I realize that perhaps the better solution would be to try and migrate my whole site to composer, because there will be similar problems all over the place .. There seem to be guides for that, like here: drupal.org/docs/installing-drupal/…, or here: github.com/grasmash/composerize-drupal among others, so I will try this when I find the time. Again thanks for your input.
    – thomas
    Jan 28, 2022 at 11:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.