Problem/Motivation
Purging of deleted fields throws fatal error. In PluginCollectionItemBase::setValue():
if (isset($values['plugin_configuration'])) {
$this->setContainedPluginConfiguration($values['plugin_configuration']);
}
assumes that $values['plugin_configuration'] is an arrya, when in fact it's a serialized value coming from the database.
Proposed resolution
Check the type of $values['plugin_configuration'] and unserialize if necessary
Remaining tasks
Write the patch
Write the test
Original report:
Hi there,
i always encounter the message "The website encountered an unexpected error. Please try again later." at the footer of my site. Means: the site runs, but the footer always contains this message. What i see in the logs (see below) seems to refer to the plugin-module (if im right).
Any hints how to solve this issue?
Thanks in advance and best regards.
Fab
TypeError: Argument 1 passed to Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase::setContainedPluginConfiguration() must be of the type array, string given, called in /var/www/virtual/sitename_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php on line 202 in Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration() (line 108 of /var/www/virtual/sitename_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php) #0 /var/www/virtual/sitename_dp/modules/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php(202): Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration('a:5:{s:4:"name"...') #1 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/TypedData/TypedDataManager.php(195): Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setValue(Array, false) #2 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(82): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemList), 0, Array) #3 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Field/FieldItemList.php(40): Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object(Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemList), 0, Array) #4 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php(66): Drupal\Core\Field\FieldItemList->createItem(0, Array) #5 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Field/FieldItemList.php(118): Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, false) #6 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/TypedData/TypedDataManager.php(106): Drupal\Core\Field\FieldItemList->setValue(Array, false) #7 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(1572): Drupal\Core\TypedData\TypedDataManager->create(Object(Drupal\field\Entity\FieldConfig), Array, 'field_payment_l...', Object(Drupal\Core\Entity\Plugin\DataType\EntityAdapter)) #8 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(175): Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object(Drupal\field\Entity\FieldConfig), 50) #9 /var/www/virtual/sitename_dp/core/modules/field/field.purge.inc(96): Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object(Drupal\field\Entity\FieldConfig), 50) #10 /var/www/virtual/sitename_dp/core/modules/field/field.module(167): field_purge_batch(50) #11 [internal function]: field_cron() #12 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Extension/ModuleHandler.php(391): call_user_func_array('field_cron', Array) #13 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Cron.php(223): Drupal\Core\Extension\ModuleHandler->invoke('field', 'cron') #14 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/Cron.php(122): Drupal\Core\Cron->invokeCronHandlers() #15 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run() #16 /var/www/virtual/sitename_dp/core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php(65): Drupal\Core\ProxyClass\Cron->run() #17 /var/www/virtual/sitename_dp/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate(Object(Symfony\Component\HttpKernel\Event\PostResponseEvent), 'kernel.terminat...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #18 /var/www/virtual/sitename_dp/vendor/symfony/http-kernel/HttpKernel.php(84): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.terminat...', Object(Symfony\Component\HttpKernel\Event\PostResponseEvent)) #19 /var/www/virtual/sitename_dp/vendor/stack/builder/src/Stack/StackedHttpKernel.php(32): Symfony\Component\HttpKernel\HttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #20 /var/www/virtual/sitename_dp/core/lib/Drupal/Core/DrupalKernel.php(634): Stack\StackedHttpKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #21 /var/www/virtual/sitename_dp/index.php(22): Drupal\Core\DrupalKernel->terminate(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Render\HtmlResponse)) #22 {main}.