PHP 8.1 - Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords()

Created on 3 March 2023, over 1 year ago
Updated 13 April 2023, about 1 year ago

Problem/Motivation

Deprecated function: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords() (line 484 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Exception Trace:
#0 /srv/www/kbportal/public_html/core/includes/bootstrap.inc(347): _drupal_error_handler_real()
#1 [internal function]: _drupal_error_handler()
#2 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(484): unserialize()
#3 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(427): Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords()
#4 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(393): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage()
#5 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple()
#6 /srv/www/kbportal/public_html/core/modules/views/src/Plugin/views/query/Sql.php(1616): Drupal\Core\Entity\EntityStorageBase->loadMultiple()
#7 /srv/www/kbportal/public_html/core/modules/views/src/Plugin/views/query/Sql.php(1541): Drupal\views\Plugin\views\query\Sql->loadEntities()
#8 /srv/www/kbportal/public_html/core/modules/views/src/ViewExecutable.php(1431): Drupal\views\Plugin\views\query\Sql->execute()
#9 /srv/www/kbportal/public_html/core/modules/views/src/ViewExecutable.php(1459): Drupal\views\ViewExecutable->execute()
#10 /srv/www/kbportal/public_html/core/modules/views/src/Plugin/views/display/Page.php(199): Drupal\views\ViewExecutable->render()
#11 /srv/www/kbportal/public_html/core/modules/views/src/ViewExecutable.php(1635): Drupal\views\Plugin\views\display\Page->execute()
#12 /srv/www/kbportal/public_html/core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
#13 [internal function]: Drupal\views\Element\View::preRenderViewElement()
#14 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array()
#15 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#16 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/Renderer.php(374): Drupal\Core\Render\Renderer->doCallback()
#17 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#18 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->render()
#19 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#20 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(243): Drupal\Core\Render\Renderer->executeInRenderContext()
#21 /srv/www/kbportal/public_html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#22 /srv/www/kbportal/public_html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#23 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#24 /srv/www/kbportal/public_html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func()
#25 /srv/www/kbportal/public_html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#26 /srv/www/kbportal/public_html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#27 /srv/www/kbportal/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#28 /srv/www/kbportal/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#29 /srv/www/kbportal/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#30 /srv/www/kbportal/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#31 /srv/www/kbportal/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#32 /srv/www/kbportal/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#33 /srv/www/kbportal/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#34 /srv/www/kbportal/public_html/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle()
#35 /srv/www/kbportal/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#36 {main}

Steps to reproduce

Doesn't show all the time. Few views based reports are showing in one of our production systems.

Proposed resolution

Check for empty prior to unserialize function.

🐛 Bug report
Status

Closed: duplicate

Version

9.5

Component
Entity 

Last updated about 8 hours ago

Created by

🇮🇳India amitsedaiz Bengaluru

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024