Top search phrases menu link can not edit

Created on 30 January 2025, about 1 month ago

Problem/Motivation

When editing a menu link created by a module dynamically, a PHP fatal error will occur.

For example the Top search phrases link created by the dblog module via the following lines.

https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/dblog...

The error messages are

Drupal\Core\Extension\Exception\UnknownExtensionException: The module does not exist. in Drupal\Core\Extension\ExtensionList->get() (line 266 of core/lib/Drupal/Core/Extension/ExtensionList.php).
Drupal\Core\Extension\ExtensionList->getName('') (Line: 107)
Drupal\Core\Menu\Form\MenuLinkDefaultForm->buildConfigurationForm(Array, Object) (Line: 74)
Drupal\menu_ui\Form\MenuLinkEditForm->buildForm(Array, Object, Object)
call_user_func_array(Array, Array) (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm('menu_link_edit', Object) (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  1. Enable the dblog module.
  2. Enable the Search module.
  3. Go to the menu link edit page (/admin/structure/menu/link/dblog.search/edit)

Proposed resolution

TBD

Remaining tasks

Test script to reproduce this bug.

User interface changes

TBD

Introduced terminology

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

πŸ› Bug report
Status

Active

Version

11.1 πŸ”₯

Component

menu system

Created by

πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί

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

Merge Requests

Comments & Activities

  • Issue created by @mingsong
  • Merge request !11061Top search phrases menu link can not edit β†’ (Open) created by mingsong
  • πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί
  • Pipeline finished with Failed
    about 1 month ago
    Total: 126s
    #410197
  • πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί

    The PHPUnit test to expose this bug has been done within the merge request.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 507s
    #410206
  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί
  • Pipeline finished with Failed
    about 1 month ago
    #410798
  • Pipeline finished with Canceling
    about 1 month ago
    #410808
  • Pipeline finished with Failed
    about 1 month ago
    Total: 501s
    #410809
  • πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί
  • πŸ‡¦πŸ‡ΊAustralia mingsong πŸ‡¦πŸ‡Ί
  • πŸ‡¨πŸ‡¦Canada Charlie ChX Negyesi 🍁Canada

    To help others a little when trying to figure out: MenuLinkDefaultForm::buildConfigurationForm() is not guilty. It rightly presumes menu links have providers because in the default storage they do have a default, it's system, it's coming from MenuTreeStorage::schemaDefinition() and the defaults in there are, not sure why but are merged into the link in MenuTreeStorage::preSave().

    No, the empty provider is coming from the MenuLinkFieldDefinitions::$defaults trait, why is that empty when after save it becomes system anyways. If I were to suggest anything I would suggest changing this to system as well -- but I don't do so. This is just an idea. Please continue not crediting me.

    And if I were curious, I would certainly wonder how come this error has not happened before -- even the earliest versions of ModuleHandler::getName would fatal return $module_data[$module]->info['name'];. What has changed? Now that we have a test (wonderful!) perhaps someone wants to git bisect.

Production build 0.71.5 2024