Roleassign help block warnings after upgrade to PHP 8.1

Created on 2 March 2023, about 2 years ago
Updated 15 March 2023, about 2 years ago

Problem/Motivation

Warning: Undefined array key "" in Drupal\user\PermissionHandler->Drupal\user\{closure}() (line 215 of /code/core/modules/user/src/PermissionHandler.php)
#0 /code/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/code/core/modu...', 215)
#1 /code/core/modules/user/src/PermissionHandler.php(215): _drupal_error_handler(2, 'Undefined array...', '/code/core/modu...', 215)
#2 [internal function]: Drupal\user\PermissionHandler->Drupal\user\{closure}(Array, Array)
#3 /code/core/modules/user/src/PermissionHandler.php(217): uasort(Array, Object(Closure))
#4 /code/core/modules/user/src/PermissionHandler.php(114): Drupal\user\PermissionHandler->sortPermissions(Array)
#5 /code/modules/contrib/roleassign/roleassign.module(18): Drupal\user\PermissionHandler->getPermissions()
#6 /code/core/modules/help/src/Plugin/Block/HelpBlock.php(97): roleassign_help('entity.node.edi...', Object(Drupal\Core\Routing\CurrentRouteMatch))
#7 /code/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\help\Plugin\Block\HelpBlock->Drupal\help\Plugin\Block\{closure}(Object(Closure), 'roleassign')
#8 /code/core/modules/help/src/Plugin/Block/HelpBlock.php(102): Drupal\Core\Extension\ModuleHandler->invokeAllWith('help', Object(Closure))
#9 /code/core/modules/block/src/BlockViewBuilder.php(171): Drupal\help\Plugin\Block\HelpBlock->build()
#10 [internal function]: Drupal\block\BlockViewBuilder::preRender(Array)

Steps to reproduce

Visit a page the contains the core help block as a non super-user. Check the logs for the above warning.

Proposed resolution

I'm not sure why \Drupal::service('user.permissions')->getPermissions() is causing the warning. But regardless, we don't need for it to be called on every page that the help block is on if it's only used on one route.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada laura.j.johnson@gmail.com Toronto

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

Comments & Activities

Production build 0.71.5 2024