Fatal error after upgrading to Drupal 10.2

Created on 21 December 2023, 11 months ago
Updated 17 July 2024, 4 months ago

Problem/Motivation

Fatal error: Declaration of Drupal\menu_link_config\Plugin\Menu\MenuLinkConfig::getEntity() must be compatible with Drupal\menu_link_content\Plugin\Menu\MenuLinkContent::getEntity(): Drupal\menu_link_content\MenuLinkContentInterface in /Users/...../web/modules/contrib/menu_link_config/src/Plugin/Menu/MenuLinkConfig.php on line 87

Steps to reproduce

The site successfully upgraded but I get this error on some pages now

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇺🇸United States loze Los Angeles

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

Merge Requests

Comments & Activities

  • Issue created by @loze
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.1 & sqlite-3.27
    last update 11 months ago
    Waiting for branch to pass
  • Status changed to Needs review 11 months ago
  • 🇺🇸United States loze Los Angeles

    This fixes the error for me and I am able to use the site now.

  • Status changed to Needs work 11 months ago
  • 🇺🇸United States loze Los Angeles

    Actually after further testing, this doesn't solve the issue.

  • Assigned to Anita verma
  • Issue was unassigned.
  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.1 & sqlite-3.27
    last update 11 months ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 8.1 & sqlite-3.27
    last update 11 months ago
    Waiting for branch to pass
  • Status changed to Needs review 11 months ago
  • 🇧🇪Belgium daften

    I've updated the MR with a patch that works for me. I made the MenuLinkConfig plugin independent from menu_link_content, which should also fix the todo that was still there.

    It's only tested briefly, so please thoroughly. I see e.g. in the menu editing for menu link config items that the machine name is not populated, not sure if that was there before.

  • 🇧🇪Belgium daften

    Updating the title, this seems to be new since Drupal 10.2 specifically

  • 🇨🇦Canada joelpittet Vancouver

    @daften, The only change here is the interface change or did you both run into other changes needed?

    This seems like the only change needed to fix this problem:

    -  public function getEntity() {
    +  public function getEntity(): MenuLinkConfigInterface {
    

    Alternatively you could change to the decorator instead of extending and avoid these kind of bugs. Would that be an OK direction for this issue?

  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & sqlite-3.27
    last update 10 months ago
    Waiting for branch to pass
  • 🇦🇲Armenia armrus

    There is a patch for module update after upgrading.

  • 🇨🇦Canada joelpittet Vancouver

    I am just going to RTBC this as it's a fatal and up the priority

  • Status changed to RTBC 4 months ago
  • 🇨🇦Canada joelpittet Vancouver

    The patch in #11 seems to be just the MR in patch form

Production build 0.71.5 2024