[PHP 8.1] Deprecated function: unserialize(): Passing null to parameter #1

Created on 16 January 2022, almost 3 years ago
Updated 9 May 2023, over 1 year ago

Problem/Motivation

After upgrade to PHP 8.1 debug log reported as below:

Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in content_access_get_settings() (line 225 of /var/www/html/modules/contrib/content_access/content_access.module)

#0 /var/www/html/core/includes/bootstrap.inc(346): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /var/www/html/modules/contrib/content_access/content_access.module(225): unserialize()
#3 /var/www/html/modules/contrib/content_access/src/Access/ContentAccessNodePageAccessCheck.php(26): content_access_get_settings()
#4 [internal function]: Drupal\content_access\Access\ContentAccessNodePageAccessCheck->access()
#5 /var/www/html/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()
#6 /var/www/html/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()
#7 /var/www/html/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()
#8 /var/www/html/core/lib/Drupal/Core/Menu/ContextualLinkManager.php(175): Drupal\Core\Access\AccessManager->checkNamedRoute()
#9 /var/www/html/core/modules/contextual/src/Element/ContextualLinks.php(72): Drupal\Core\Menu\ContextualLinkManager->getContextualLinksArrayByGroup()
#10 [internal function]: Drupal\contextual\Element\ContextualLinks::preRenderLinks()
#11 /var/www/html/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#12 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(772): Drupal\Core\Render\Renderer->doTrustedCallback()
#13 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(363): Drupal\Core\Render\Renderer->doCallback()
#14 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender()
#15 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(145): Drupal\Core\Render\Renderer->render()
#16 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#17 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(146): Drupal\Core\Render\Renderer->executeInRenderContext()
#18 /var/www/html/core/modules/contextual/src/ContextualController.php(82): Drupal\Core\Render\Renderer->renderRoot()
#19 [internal function]: Drupal\contextual\ContextualController->render()
#20 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#21 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#23 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#24 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#25 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#26 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#27 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#28 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#29 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#30 /var/www/html/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle()
#31 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#32 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#35 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle()
#36 {main}

Steps to reproduce

Upgrade to PHP 8.1.

Navigate to Manage » Structure » Content types. Under operations, Select "Access control" for any content type.

Proposed resolution

Fix the problem by fixing either one of these:

  1. 📌 Remove ACL integration Postponed
  2. 🐛 [PHP 8.1] Deprecated function: mb_strlen(): Passing null to parameter #1 Fixed
🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇭🇰Hong Kong hswong3i

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024