Since the introduction of https://www.drupal.org/node/2731369 I am getting the following error on drush site install. I get similar errors related to multiple modules (e.g. workflow, eform). I note in the other issue thread another user getting a similar problem from another module.
Notice: Undefined index: entity.eform_type.collection in admin_toolbar_tools_menu_links_discovered_alter() (line 600 of /vagrant/app/modules/contrib/admin_toolbar/admin_toolbar_tools/admin_toolbar_tools.module) #0 /vagrant/app/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined index...', '/vagrant/app/mo...', 600, Array)
#1 /vagrant/app/modules/contrib/admin_toolbar/admin_toolbar_tools/admin_toolbar_tools.module(600): _drupal_error_handler(8, 'Undefined index...', '/vagrant/app/mo...', 600, Array)
#2 /vagrant/app/core/lib/Drupal/Core/Extension/ModuleHandler.php(501): admin_toolbar_tools_menu_links_discovered_alter(Array, NULL, NULL)
#3 /vagrant/app/core/lib/Drupal/Core/Menu/MenuLinkManager.php(168): Drupal\Core\Extension\ModuleHandler->alter('menu_links_disc...', Array)
#4 /vagrant/app/core/lib/Drupal/Core/Menu/MenuLinkManager.php(191): Drupal\Core\Menu\MenuLinkManager->getDefinitions()
#5 /vagrant/app/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(61): Drupal\Core\Menu\MenuLinkManager->rebuild()
#6 /vagrant/app/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(49): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild()
#7 /vagrant/app/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild(Object(Symfony\Component\EventDispatcher\Event), 'routing.route_f...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#8 /vagrant/app/core/lib/Drupal/Core/Routing/RouteBuilder.php(192): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('routing.route_f...', Object(Symfony\Component\EventDispatcher\Event))
#9 /vagrant/app/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
#10 /vagrant/app/core/includes/common.inc(1141): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
#11 /vagrant/app/core/includes/utility.inc(52): drupal_flush_all_caches()
#12 /vagrant/vendor/drush/drush/commands/core/cache.drush.inc(302): drupal_rebuild(Object(Composer\Autoload\ClassLoader), Object(Symfony\Component\HttpFoundation\Request))
#13 /vagrant/vendor/drush/drush/includes/command.inc(422): drush_cache_rebuild()
#14 /vagrant/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#15 /vagrant/vendor/drush/drush/includes/command.inc(199): drush_command()
#16 /vagrant/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#17 /vagrant/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
Attached is a small alt that fixes the issue.
Comments
Comment #2
mikejw commentedComment #3
mikejw commentedComment #4
mikejw commentedComment #5
adriancidHi @mikejw thanks for reporting, would be great if the next time you use the Issue Summary Template to report an issue. I will check this in the next days.
Comment #6
adriancid@mikejw I'm not able to reproduce the issue with the last dev version, can you check again please?
If the issue persist please add steps to reproduce and change the issue status.
Comment #7
mikejw commentedAhhh, thanks for pointing me to the issue summary template - had forgotten about that.
Just tried another build with 1.x-dev and before that 1.21 and same error.
In my case this is happening on a site where the install profile includes workflow and eform and I install the site using `drush site-install`. It also throws the error after the site is installed and I do a `drush cr`.
This is on Drupal 8.4.2.
Comment #8
websiteworkspace commentedDrupal 8.4.2 - version 8.x-1.21 of this module
-----------------------------------------
Whenever clearing cache ...
The following error:
is generated eight (8) times and recorded in the http error log.
This error can also be reproduced when using drupal console to clear the cache.
The function - admin_toolbar_tools_menu_links_discovered_alter(&$links) is being executed when these errors occur.
The code is iterating the following loop when the error occurs at - $parentlink = $links[$link['parent']]; - within the loop.
Comment #9
adriancid@mikejw and @websiteworkspace check if #2925327: Better check for is-link-in-admin-menu for local task links solve the problem.
Comment #10
websiteworkspace commentedThere is more than one patch listed at the following link:
https://www.drupal.org/project/admin_toolbar/issues/2925327
Which if any of these patches are you recommending?
Both seem to insert a new section of code at around line 539.
However, it seems like a prudent coder would add some additional integrity checking at line 600 itself
$parentlink = $links[$link['parent']];
to further guard against the empty array index problem at that location, providing additional "sanity" checking of the referenced data.
Comment #11
adriancidtry this patch https://www.drupal.org/project/admin_toolbar/issues/2925327#comment-1235... and let my know if works fine.
Comment #12
berdirNo, #2925327: Better check for is-link-in-admin-menu for local task links is about a different problem and not related.
The fix makes sense to me and is similar to #2873577: Do not define menu links for entity bundles when the parent is not defined. that I once opened, but this is a bit more generic.
Comment #13
adriancidThanks @Berdir, if you're able to reproduce the issue can you test the patch to see if it works?
Comment #14
BrianLewisDesign commentedPatch 2 from #2 works for me.
Comment #16
adriancidThanks to @all :-)
Comment #17
mikejw commentedThanks!
Comment #19
websiteworkspace commentedThis bug should not be marked as "fixed" since there still isn't a release version of this module that includes the patch that repairs the reported problem.