LogicException: The database connection is not serializable.

Created on 6 April 2023, about 1 year ago
Updated 27 April 2023, about 1 year ago

Problem/Motivation

Error when saving subscriptions on user profile page:

LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection->__sleep() (line 1687 of /home2/atwh9578/***/core/lib/Drupal/Core/Database/Connection.php). {"severity_level":3,"@backtrace_string":"#0 [internal function]: Drupal\\Core\\Database\\Connection->__sleep()
#1 /home2/atwh9578/***/modules/contrib/danse/modules/form/src/Payload.php(74): serialize()
#2 /home2/atwh9578/***/modules/contrib/danse/src/PayloadBase.php(35): Drupal\\danse_form\\Payload->prepareArray()
#3 /home2/atwh9578/***/modules/contrib/danse/src/Entity/Event.php(55): Drupal\\danse\\PayloadBase->toArray()
#4 /home2/atwh9578/***/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(87): Drupal\\danse\\Entity\\Event::preCreate()
#5 /home2/atwh9578/***/core/lib/Drupal/Core/Entity/ContentEntityBase.php(1143): Drupal\\Core\\Entity\\ContentEntityStorageBase->create()
#6 /home2/atwh9578/***/modules/contrib/danse/src/PluginBase.php(365): Drupal\\Core\\Entity\\ContentEntityBase::create()
#7 /home2/atwh9578/***/modules/contrib/danse/modules/form/src/Plugin/Danse/Form.php(47): Drupal\\danse\\PluginBase->createEvent()
#8 /home2/atwh9578/***/modules/contrib/danse/modules/form/danse_form.module(45): Drupal\\danse_form\\Plugin\\Danse\\Form->createFormEvent()
#9 [internal function]: danse_form_submit_event()
#10 /home2/atwh9578/***/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array()
#11 /home2/atwh9578/***/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\\Core\\Form\\FormSubmitter->executeSubmitHandlers()
#12 /home2/atwh9578/***/core/lib/Drupal/Core/Form/FormBuilder.php(595): Drupal\\Core\\Form\\FormSubmitter->doSubmitForm()
#13 /home2/atwh9578/***/core/lib/Drupal/Core/Form/FormBuilder.php(323): Drupal\\Core\\Form\\FormBuilder->processForm()
#14 /home2/atwh9578/***/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\\Core\\Form\\FormBuilder->buildForm()
#15 [internal function]: Drupal\\Core\\Controller\\FormController->getContentResult()
#16 /home2/atwh9578/***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /home2/atwh9578/***/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()
#18 /home2/atwh9578/***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\\Core\\Render\\Renderer->executeInRenderContext()
#19 /home2/atwh9578/***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /home2/atwh9578/***/vendor/symfony/http-kernel/HttpKernel.php(163): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()
#21 /home2/atwh9578/***/vendor/symfony/http-kernel/HttpKernel.php(74): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#22 /home2/atwh9578/***/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#23 /home2/atwh9578/***/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\\Core\\StackMiddleware\\Session->handle()
#24 /home2/atwh9578/***/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle()
#25 /home2/atwh9578/***/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\\page_cache\\StackMiddleware\\PageCache->pass()
#26 /home2/atwh9578/***/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\\page_cache\\StackMiddleware\\PageCache->handle()
#27 /home2/atwh9578/***/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle()
#28 /home2/atwh9578/***/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\\Core\\StackMiddleware\
egotiationMiddleware->handle()
#29 /home2/atwh9578/***/core/lib/Drupal/Core/DrupalKernel.php(686): Drupal\\Core\\StackMiddleware\\StackedHttpKernel->handle()
#30 /home2/atwh9578/***/index.php(19): Drupal\\Core\\DrupalKernel->handle()
#31 {main}","exception":[],"channel":"php","link":"","uid":"1","request_uri":"https://***/fr/user/1/subscriptions","referer":"https://***/fr/user/1/subscriptions","ip":"**.**.**.**","timestamp":1680773426}

Steps to reproduce

- Create a subscription on a content type
- Subscribe to this event on a user profile subscription page

Workarround

You can disable danse_form submodule to avoid this error.

Version

D10.0.7
PHP 8.1.17
DANSE 2.2.15, also tested with 2.2.x-dev

πŸ› Bug report
Status

Fixed

Version

2.2

Component

User interface

Created by

πŸ‡«πŸ‡·France jeremy.zimmermann

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

Comments & Activities

Production build 0.69.0 2024