Context Breadcrumb throws url error

Created on 13 October 2023, about 1 year ago

Problem/Motivation

Hi,
Context Breadcrumb has nine available rows to create a breadcrumb. The ContextBreadcrumbBuilder will loop through all nine rows, regardless of whether they are empty. With the change in https://git.drupalcode.org/project/context_breadcrumb/-/commit/fb1de0ac0... we changed the check from mb_strlen() to isset(). Because the title is set for every row but empty (see screenshot), the check will pass, and the statement Url::fromUserInput($contextBreadcrumb['url']) will throw an error The user-entered string '' must begin with a '/', '?', or '#'. because the URL is an empty string.

Steps to reproduce

  1. Create a context with breadcrumb for a route
  2. Leave some rows empty
  3. Visit the route and check watchdog log

Proposed resolution

Change check from isset() to !empty()

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇩🇪Germany mvogel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024