Problem/Motivation

We receive this exception on pages with disabled menu links after upgrading from Drupal core 11.2 to 11.3.
Applying the patch from #2973515: MenuActiveTrail should ignore disabled menu links resolves it.
I realize it is most likely more of an issue in core, but since it breaks menu_breadcrumb, thought I would post here for anyone else who runs into this.

Error: Call to a member function getUrl() on null in Drupal\menu_breadcrumb\MenuBasedBreadcrumbBuilder->build() (line 364 of modules/contrib/menu_breadcrumb/src/MenuBasedBreadcrumbBuilder.php).
Drupal\Core\Breadcrumb\BreadcrumbManager->build() (Line: 73)
Drupal\system\Plugin\Block\SystemBreadcrumbBlock->build() (Line: 106)
Drupal\layout_builder\EventSubscriber\BlockComponentRenderArray->onBuildRender() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 117)
Drupal\layout_builder\SectionComponent->toRenderArray() (Line: 88)
Drupal\layout_builder\Section->toRenderArray() (Line: 349)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildSections() (Line: 309)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple() (Line: 365)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 29)
Drupal\node\NodeViewBuilder->buildComponents() (Line: 307)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 264)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 910)
Drupal\Core\Render\Renderer->doCallback() (Line: 441)
Drupal\Core\Render\Renderer->doRender() (Line: 230)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 634)
Drupal\Core\Render\Renderer::Drupal\Core\Render\{closure}()
Fiber->resume() (Line: 649)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 118)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 92)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 54)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 745)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Visit a page with a menu item that happens to be disabled, while using this module and Drupal 11.3.

Proposed resolution

Apply the patch from this MR to your site:
https://www.drupal.org/project/drupal/issues/2973515

Could possibly update this module to ignore disabled menu items as well.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#8 3567562-8.patch2.7 KBgcb
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

john.oltman created an issue. See original summary.

john.oltman’s picture

Issue summary: View changes
cafuego’s picture

cafuego’s picture

Sadly the patch from the related issue does not fix my problem.

orakili made their first commit to this issue’s fork.

orakili’s picture

Status: Active » Needs review

Created MR with a simple fix that checks the links array is not empty. This solves the issue on our side.

gcb’s picture

StatusFileSize
new2.7 KB

Attaching the MR as a patch for stable use in builds.

cafuego’s picture

Status: Needs review » Reviewed & tested by the community

Seems to work as advertised :-)

xurizaemon made their first commit to this issue’s fork.

  • xurizaemon committed 403ce36c on 2.0.x authored by orakili
    Issue #3567562: Fix exception for pages with disabled menu items
    
xurizaemon’s picture

Category: Support request » Bug report
Status: Reviewed & tested by the community » Fixed

Thanks team!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.