TypeError: strnatcasecmp(): Argument #1 ($string1) must be of type string, Drupal\system\Entity\Menu given in strnatcasecmp() (line 97 of /app/web/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php)

Created on 15 August 2023, over 1 year ago
Updated 13 December 2023, about 1 year ago

Problem/Motivation

When the module is enabled, trying to place a block in any region of the Block Layout page results in the error below, which breaks the Ajax of the "Place Block" option.

I'm using Drupal Mega Menu 1.14.0 and Drupal Core 9.5.10.

TypeError: strnatcasecmp(): Argument #1 ($string1) must be of type string, Drupal\system\Entity\Menu given in strnatcasecmp() (line 97 of /app/web/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php)
#0 /app/web/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php(97): strnatcasecmp(Object(Drupal\system\Entity\Menu), Object(Drupal\system\Entity\Menu))
#1 [internal function]: Drupal\Core\Block\BlockManager->Drupal\Core\Plugin\{closure}(Array, Array)
#2 /app/web/core/lib/Drupal/Core/Plugin/CategorizingPluginManagerTrait.php(98): uasort(Array, Object(Closure))
#3 /app/web/core/lib/Drupal/Core/Block/BlockManager.php(75): Drupal\Core\Block\BlockManager->traitGetSortedDefinitions(Array, 'admin_label')
#4 /app/web/core/modules/block/src/Controller/BlockLibraryController.php(113): Drupal\Core\Block\BlockManager->getSortedDefinitions(Array)
#5 [internal function]: Drupal\block\Controller\BlockLibraryController->listBlocks(Object(Symfony\Component\HttpFoundation\Request), 'plnz4')
#6 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#7 /app/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#8 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#9 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#10 /app/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 /app/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#12 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /app/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#21 {main}

Steps to reproduce

  1. Enable the module
  2. Go to Structure > Block layout
  3. Use the "Place block" option to try to add a block to any region
🐛 Bug report
Status

Active

Version

1.14

Component

Code

Created by

🇨🇴Colombia camilo.escobar

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

Comments & Activities

Production build 0.71.5 2024