Role::postLoad() warning on every load

Created on 14 April 2023, about 2 years ago

Problem/Motivation

Every page load, public or within admin generates 30+ warning log entries.

Running Drupal 9.5.7 on PHP 8.1.17

Steps to reproduce

Load any page in the build

Proposed resolution

Fix core user role method to use an expression that is supported in new versions of PHP.

Deprecated function: Use of "static" in callables is deprecated in Drupal\user\Entity\Role::postLoad() (line 172 of /web/core/modules/user/src/Entity/Role.php)
#0 /web/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /web/core/modules/user/src/Entity/Role.php(172): uasort()
#3 /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(423): Drupal\user\Entity\Role::postLoad()
#4 /web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(353): Drupal\Core\Entity\EntityStorageBase->postLoad()
#5 /web/core/modules/user/src/RoleStorage.php(16): Drupal\Core\Entity\EntityStorageBase->loadMultiple()
#6 /web/core/lib/Drupal/Core/Session/UserSession.php(112): Drupal\user\RoleStorage->isPermissionInRoles()
#7 /web/core/lib/Drupal/Core/Session/AccountProxy.php(105): Drupal\Core\Session\UserSession->hasPermission()
#8 /web/modules/contrib/devel/src/EventSubscriber/ErrorHandlerSubscriber.php(39): Drupal\Core\Session\AccountProxy->hasPermission()
#9 [internal function]: Drupal\devel\EventSubscriber\ErrorHandlerSubscriber->registerErrorHandler()
#10 /web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#11 /vendor/symfony/http-kernel/HttpKernel.php(145): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#12 /vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#13 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#14 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#15 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#16 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#17 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#18 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#19 /vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#20 /web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#21 /web/index.php(19): Drupal\Core\DrupalKernel->handle()
#22 {main}
πŸ› Bug report
Status

Closed: duplicate

Version

9.5

Component
User moduleΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States emptyvoid

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

Comments & Activities

Production build 0.71.5 2024