Drupal version: 8.0.0-beta15
Drush version: 8.0-dev
Enabling the module via Drush results in the following error.
PHP Fatal error: Cannot instantiate interface Drupal\Core\Cache\CacheBackendInterface in /Users/huijing/Sites/drupal8.dev/core/lib/Drupal/Component/DependencyInjection/Container.php on line 265
Fatal error: Cannot instantiate interface Drupal\Core\Cache\CacheBackendInterface in /Users/huijing/Sites/drupal8.dev/core/lib/Drupal/Component/DependencyInjection/Container.php on line 265
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Cannot instantiate interface
Drupal\Core\Cache\CacheBackendInterface in
/Users/huijing/Sites/drupal8.dev/core/lib/Drupal/Component/DependencyInjection/Container.php,
line 265
Re-running the command drush en admin_menu -y outputs the following message:
admin_menu is already enabled. [ok]
There were no extensions that could be enabled.
However, loading the site results in the following WSOD error message:
Fatal error: Call to undefined function user_access() in ../Sites/drupal8.dev/modules/admin_menu/admin_menu.module on line 149
Comments
Comment #2
huijing commentedComment #3
2phaI just installed a new D8 site and came across this.
for CachBackendInterface error, in .yml files (admin_menu.services.yml)
this:
factory_service: cache_factoryneeds to change to:
factory: cache_factory:get!user_access('access administration menu')needs to change to:
!\Drupal::currentUser()->hasPermission('access administration menu')$current_path = current_path();changes to:
$current_path = \Drupal::request()->getRequestUri();I then hit another error with drupal_http_build_query() and gave up.
EDIT:
Then tried to uninstall and got Call to undefined function variable_del()
:(
Comment #4
hongpong commentedAlso had this happen on a plain new site, very first thing: drush dl admin_menu; drush en admin_menu
Also get probably related to note above:
Fatal error: Call to undefined function user_access() in /modules/admin_menu/admin_menu.module on line 149
Comment #5
sylvain lavielle commentedGot that too
Comment #6
hongpong commentedI took a shot at rolling a patch for the notes from @2pha above . Also I put a todo on the .install which has the deprecated variable_set, someone needs to decide on a name for the Config object involved as specified here: https://www.drupal.org/node/1667896 {not sure if the patch formatting is ok, i created it out of a commit instead of the correct way}. for more see #2401457: replace system variables with configuration API
I don't know if we have the right cache factory setting yet. After making these changes I got in drush attempting to enable:
The code for that exception is here.
Anyway at least the patch gets rid of the fatal errors! Also I am setting this as a child issue of the overall 8.x meta issue #2398395: [meta] Port Admin Menu to Drupal 8. Yayz, onwards.
Comment #7
damien_vancouver commentedvariable_del() isn't there in Drupal 8 and so we also need to comment out those variable_del() calls or you get an error trying to uninstall.
Attached is the patch from #6 with the variable_del()'s commented out.
Comment #8
huijing commentedApplied patch #7 to the existing "broken" drupal 8 installation. Trying to load the site still gives a WSOD but with a different error message:
Fatal error: Call to undefined function drupal_http_build_query() in /Users/huijing/Sites/d8.dev/modules/admin_menu/admin_menu.module on line 178Comment #9
hongpong commented@huijing bartuc posted a patch a year ago to cover this: https://www.drupal.org/files/issues/drupal-http-build-query-fix-2284015.... at #2284015: Undefined function drupal_http_query. Might as well roll it in to ours now. Note the class must be explicitly included as well now.
Also there are replacements for variable_set() & variable_get() included in #2401457: replace system variables with configuration API . Since they haven't been committed yet maybe we should combine from all three threads to consolidate this?
Comment #10
hongpong commentedHere is a patch that should include everything above in - also with the one on #2284015: Undefined function drupal_http_query doesn't apply cleanly so here it is. The module at least doesn't error out, we have to now add config settings back into it.
Also I caught another one, the Path core module is required or it fatals out. So I think I added that correctly to fancy new yaml format info.yml.
Comment #11
hongpong commentedComment #12
hongpong commentedComment #13
joachim commentedThere's already issues with patches for various things covered here, eg #2457801: Replace user_access function with Drupal::currentUser()->hasPermission method. Please search for existing patches and review them before filing new patches :)
Comment #14
hongpong commentedGood call @joachim, I posted a new patch there that only adds a fix for the fatal error they got (path module not required), it seems RTBC. It is a little bit tricky situation since there are several sources for fatal errors on head right now, so something's gotta get committed in order to make patches that move us out of fatals.
Comment #15
kmontyThis is a dup off #2457801: Replace user_access function with Drupal::currentUser()->hasPermission method
Comment #16
Swetha Yarla commentedComment #17
kappaluppa commentedComment #15 says this is a duplicate, but is the duplicate only of the issue named in #13, or of all the various items covered in the patch named in #10. Did it come down to "Replace user_access function with Drupal::currentUser()->hasPermission method" being the main underlying issue?
Comment #18
niccottrell commentedI'm still getting this in the latest dev release from 2015-Mar-20 - has it come back - or was -dev never patched?
Comment #19
mangamike commentedI'm getting this error in a local install. Has this patch been applied to the latest stable release?
Comment #20
bradallenfisher commentedI just got this as well.
Comment #21
MattMeadows commentedGetting this same issue.
Seemed to only occur after installing admin_menu module.
Following apache errors are output:
Cannot instantiate interface Drupal\\Core\\Cache\\CacheBackendInterface in /core/lib/Drupal/Component/DependencyInjection/Container.php on line 268
Comment #22
2phaThere have still been no commits since March 2015 so none of these patches have been applied.
Comment #23
alokvermaei commentedYes i have got the same after enabling admin menu module. the problems seems on line 153 (hook implemented for page bottom).
Comment #24
kclarkson commentedI am lost on this issue. I tried applying the @HongPong's patch to the git 8.x-3.x but am still receiving errors.
Can someone let me know what patches I have to apply if this is already fixed.
Comment #25
rodtatham commented@kclarkson, I followed @milazi's steps (look for #19 here -
https://www.drupal.org/node/2259267).
Worked for me!
Comment #26
aditya.n commentedI am changing the status back to needs work, since the duplicate issue tagged, does not cover this issue completely and the bug still persists.
Comment #27
aditya.n commentedI have removed most of the deprecated code off the module and used the drupal's 8.2.x's standard functions, also I have changed
Which seemed to produce this particular issue(2563867).
Submitting the patch with other changes aswel.
Comment #29
hongpong commented@aditya.n this patch #27 looks like a good start, I wish it would be committed and then further development would be much easier to figure out.
Comment #30
aditya.n commented@HongPong, yes, but still a lot of work will be required, the hook_theme() used in drupal 8 now requires twig files with the name of the keys of the array defined in hook_theme(). Without that, the menu won't render at all, so new files also need to be added and a lot of code needs to be changed. Hope the maintainers find this patch helpful. :)
Comment #31
awelch commentedI just got the same error on install
and attempted uninstall via drush :
Error: Call to undefined function variable_del()Comment #32
cilefen commentedThis is at least major, and perhaps critical.
Comment #33
vmamidela commentedHi,
I'm using admin_menu module, after applying above patch, it stopped above error, however I'm seeing below error now .
Uncaught PHP Exception Twig_Error_Loader: "Template "profiles/test_profile/modules/contrib/admin_menu/templates/admin-menu-links.html.twig" is not defined (Drupal\\Core\\Template\\Loader\\ThemeRegistryLoader: Unable to find template "profiles/test_profile/modules/contrib/admin_menu/templates/admin-menu-links.html.twig" in the Drupal theme registry.)." at /var/www/sites/drupal/docroot_drupal_core_1910201629/vendor/twig/twig/lib/Twig/Loader/Chain.php line 115
Could you help me where can I find admin-menu-links.html.twig template for admin_menu module.
Comment #34
2phaI have switched to using the Admin Toolbar module instead
Comment #35
bdanin commentedI agree that admin_toolbar is the way to go for Drupal 8
Comment #36
sandramandy commentedDisable the admin_menu doesn't solve this. Tried it but still got the fatal error. Any solutions to this issue?
Comment #37
beautifulmindThe best we can do is remove this module. If you try to uninstall it, it will throw more errors.
Comment #38
nachocode commentedI've got this same error when installed the module on a fresh installation using drush 8.1.9
When tried to uninstall it, I've got the variable_del() not found.
In the end, I decided to use admin_toolbar module and eliminate the errors by removing the directory from modules/. Works as a this module is expected to work.
Comment #39
thallesThis module has been deprecated for Drupal 8.
For Drupal 8: the Admin Toolbar provides an experience similar to admin_menu with the core toolbar.
Comment #40
thallesComment #41
thalles