Problem/Motivation
cookiebot_preprocess_menu() runs for every menu on the site and calls $item['url']toString(), assuming $item['url'] is always a \Drupal\Core\Url object. It isn't always, some menus expose url as a plain string.
Gin admin theme, whose "Content" navigation region builds menu items with a string url (e.g. Url::fromRoute('system.admin_content')toString()), so admin pages crash.
Steps to reproduce
Enable Cookiebot and set a Cookiebot ID.
Use the Gin theme as the admin theme.
Visit /admin/conten
The page errors with "Call to a member function toString() on string".
Proposed resolution
Only call toString() when $item['url'] is actually a \Drupal\Core\Url object.
Non-Url items are safely skipped (they can never match /cookiebot-renew), so no behaviour changes.
Issue fork cookiebot-3601092
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
Comment #3
bramdriesenSetting to NR as there is a MR created?
Comment #4
bramdriesenSmall nitpick by phpcs, the rest was already there.