I am having difficulty with the libraries module after upgrading to Drupal 10. When I upgrade on my local without a full build (just upgrading using the existing db) I get the following on some admin pages:
Error: Call to undefined method Drupal\Core\Extension\ModuleHandler::getImplementations() in libraries_info() (line 407 of modules/contrib/libraries/libraries.module).
When I run the build through ci, I get this right after libraries installs during setup-app:
[error] TypeError: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): Argument #1 ($object) must be of type object, null given in Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash() (line 87 of /mnt/tmp/local.prod/source/docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php) #0 [internal function]: Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash()
#1 /mnt/tmp/local.prod/source/docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php(75): array_map()
etc.... truncated
When I tried blt drupal:install on my local, I got the same exact result.
Comments
Comment #2
loopy1492 commentedComment #3
loopy1492 commentedComment #4
loopy1492 commentedComment #5
loopy1492 commentedI started working on this but I am NOT confident enough in the workings of this module to make any contributions at this time. For now, we will disable the module.
Here is what I have so far. It seemed to stop the error but I don't know if it messed anything else up. I just started changing things; I didn't delve into the guts of how it all works. Someone who knows what they are doing needs to fix this instead.
Comment #6
loopy1492 commentedComment #7
bmustafa commentedi am getting this error too:
[29-Apr-2023 05:48:58 Asia/Dubai] Uncaught PHP Exception Error: "Call to undefined method Drupal\Core\Extension\ModuleHandler::getImplementations()" at D:\wamp64\www\seo_saja_drupal_backoffice\web\modules\contrib\libraries\libraries.module line 407
the module is not usable at this stage.
the above code suggestion did not work for, despite error gone, but the module does not function
Comment #8
willempje2 commentedTake a look at: https://www.drupal.org/project/libraries/issues/3342032
Seems to be same problem.
Comment #9
loopy1492 commentedComment #10
joseph.olstadIf you notice this, please upgrade to libraries version 4.0.3 or newer
see
#3342032: Undefined method getImplementations()
Comment #11
joseph.olstadhttps://www.drupal.org/project/libraries/releases/4.0.3
Comment #12
ashetkar commentedIssue still exits in https://www.drupal.org/project/libraries/releases/4.0.3 module version.
error] TypeError: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): Argument #1 ($object) must be of type object, null given in Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash() (line 87 of /home/vsts/work/1/s/docroot/core/lib/Drupal/Component/DependencyInjection/ReverseContainer.php) #0 [internal function]: Drupal\Component\DependencyInjection\ReverseContainer->generateServiceIdHash
Comment #13
joseph.olstad@ashetar please open a new issue to report the steps to reproduce. You might want to try: remove the modules/contrib folder and re-run composer install to make sure that your files are 100% in sync with the expected version 4.0.3. Then rebuild caches and re-test
Comment #14
ashetkar commented@joseph.olstad
Opened issue here.
https://www.drupal.org/project/libraries/issues/3367706
Comment #15
alfattal commented@joseph.olstad I'm having the same issue. I've tried removing modules/contrib and following your suggested steps but that didn't help and I'm still getting the same error message.
Comment #16
joseph.olstadthis is likely caused by one of your contrib modules that needs to be upgraded , the module may provide a library, or the library it'self may need to be upgraded.
Prior to upgrading to Drupal 10 you should use the upgrade_status module to display a report about your compatibility
You may also need to scan your custom modules using the scanning tool included with upgrade_status
drush us-a mymodulenameComment #17
joseph.olstadWhat you can do is use this debugging technique and look at the stack of calls, look for module names and library names involved.
look at the comments on this page, explains a bit , put the debug right in the file that is throwing the error.
https://www.php.net/manual/en/function.debug-print-backtrace.php
Comment #18
joseph.olstad#3367706: Drupal\Component\DependencyInjection\ReverseContainer::generateServiceIdHash(): after installing libraries module
Comment #19
rakshith.thotada commentedI think if you have exported libraries config to default folder -> libraries.settings.yml - Delete it and setup in CI should work fine.
This I tried after a lot of iteration. Finally it worked
Also after libraries module installation - reexport the config