Fix fatal 'TypeError: ModulePermissionsLinkHelper::getModulePermissionsLink(): Argument #2 ($name) must be of type string, array given'

Created on 5 June 2024, 7 months ago
Updated 19 June 2024, 6 months ago

Problem/Motivation

TypeError: Drupal\user\ModulePermissionsLinkHelper::getModulePermissionsLink(): Argument #2 ($name) must be of type string, array given, called in /docroot/core/modules/system/system.module on line 992 in Drupal\user\ModulePermissionsLinkHelper->getModulePermissionsLink() (line 47 of core/modules/user/src/ModulePermissionsLinkHelper.php).
system_get_module_admin_tasks('block_class', Array) (Line: 95)
Drupal\block_class\Controller\BlockClassController->index()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
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: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

navigate to /admin/block-class/help

Proposed resolution

Change the second argument to use module's display name instead of module's info array.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France dydave

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

Merge Requests

Comments & Activities

  • Issue created by @dydave
  • Pipeline finished with Failed
    7 months ago
    Total: 190s
    #191646
  • Pipeline finished with Success
    7 months ago
    Total: 159s
    #191655
  • Assigned to rajdip_755
  • 🇮🇳India rajdip_755 kolkata

    Hi @DYdave, I can replicate this issue. I'm working on this.
    I think it will be better to replace the system_get_module_admin_tasks() as it's already marked as deprecated in drupal 10.2.0 .

  • Pipeline finished with Failed
    7 months ago
    Total: 204s
    #191670
  • Issue was unassigned.
  • 🇫🇷France dydave

    Hi Rajdip (@rajdip_755)!

    Thanks for your prompt follow-up on this!

    Watchout: This is much trickier than it seems ⚠️

    We're trying to support multiple versions of Drupal Core for the module in the 2.0.x branch, in particular D9 and D10.

    The current code works for D9, D10.0, D10.1 and breaks as of D10.2.

    We're currently trying to figure out what's the best option moving forward... probably creating a new branch which would most likely drop support for D10.1 (so only supports D10.2 and above).

    We've mostly got the fix for D10.2 already in merge request MR!37, see related issue 🐛 Deprecated system_get_module_admin_tasks in drupal:10.2.0 and is removed from drupal:11.0.0 Needs review .

    Mostly this ticket is to fix the module for D9, D10.0 and D10.1.
    Once we've got that fixed, we should be able to get back to 🐛 Deprecated system_get_module_admin_tasks in drupal:10.2.0 and is removed from drupal:11.0.0 Needs review , create a new minor development branch and get MR37 merged in.

    I'm currently working on this issue, fixing phpunit tests and broadening test coverage.

    Feel free to let us know if you have any questions or concerns on any aspects of this issue or the project in general, we would surely be glad to help.
    Thanks in advance!

  • Pipeline finished with Failed
    7 months ago
    Total: 169s
    #191764
  • Pipeline finished with Success
    7 months ago
    Total: 295s
    #191785
  • Pipeline finished with Failed
    7 months ago
    Total: 176s
    #191802
  • Pipeline finished with Success
    7 months ago
    Total: 175s
    #191808
    • DYdave committed be46c25e on 2.0.x
      Issue #3452633 by DYdave: Broadened Gitlab CI tests coverage. Fixed...
  • Status changed to Fixed 7 months ago
  • 🇫🇷France dydave

    Quick follow-up on this issue:

    A few additional commits were added to the current merge request MR!41 with a few comments, see above at #4.

    Mostly:

    • Fixed fatal TypeError with compatibility support for 10.2 and above without breaking backward compatibility
    • Broadened Gitlab CI tests coverage.
    • Fixed compatibility tests for D9.
    • Added initial Functional tests class for the admin Help page.

     
    The tests all seemed to pass for the MR so the changes have been merged in branch 2.0.x, which seems to still be passing 🟢
    https://git.drupalcode.org/project/block_class/-/pipelines/191822
    (for the different Drupal versions tested)

    Marking issue as Fixed for now.
    Thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024