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}.
Comment | File | Size | Author |
---|---|---|---|
#16 | 2867701-16.patch | 901 bytes | nginex |
Comments
Comment #2
Pascal- CreditAttribution: Pascal- commentedSame issue, cannot execute Cron because of this.
Cannot uninstall module because I have to run cron to uninstall Payment Form Field module which needs cron to run before I can uninstall it because it has fields pending deletion.
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase::setContainedPluginConfiguration() must be of the type array, string given, called in /var/www/drupalvm/eura/webroot/modules/contrib/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php on line 202 in Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration() (line 108 of modules/contrib/plugin/src/Plugin/Field/FieldType/PluginCollectionItemBase.php).
Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setContainedPluginConfiguration('a:5:{s:4:"name";s:13:"payment_basic";s:8:"quantity";s:1:"1";s:6:"amount";s:2:"50";s:13:"currency_code";s:3:"EUR";s:11:"description";s:19:"kjh hsqkdhsqhdjkqsh";}') (Line: 202)
Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase->setValue(Array, ) (Line: 195)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 0, Array) (Line: 82)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object, 0, Array) (Line: 40)
Drupal\Core\Field\FieldItemList->createItem(0, Array) (Line: 66)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, ) (Line: 118)
Drupal\Core\Field\FieldItemList->setValue(Array, ) (Line: 106)
Drupal\Core\TypedData\TypedDataManager->create(Object, Array, 'field_pay', Object) (Line: 1579)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object, 50) (Line: 175)
Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object, 50) (Line: 96)
field_purge_batch(50) (Line: 167)
field_cron()
call_user_func_array('field_cron', Array) (Line: 391)
Drupal\Core\Extension\ModuleHandler->invoke('field', 'cron') (Line: 223)
Drupal\Core\Cron->invokeCronHandlers() (Line: 122)
Drupal\Core\Cron->run() (Line: 75)
Drupal\Core\ProxyClass\Cron->run() (Line: 171)
Drupal\admin_toolbar_tools\Controller\ToolbarController->runCron()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #3
stone_d CreditAttribution: stone_d commentedok, maybe i can help u:
I solved this by searching for the Object-parts (s:4 bla bla bla) in my database and found the entry within a payment-item.
I deleted all payment entries/Items manually out of the database. After that i was able to go on. Tell me if that worked for u too!
Regards,
Fab
Comment #4
Pascal- CreditAttribution: Pascal- commentedThanks, that really helped!
Searched for: s:4:"name";s:13:"payment_basic";
As mentioned in my error on running cron.
Found two database fields and removed them manually.
Issue is solved now!
Comment #5
Bahson CreditAttribution: Bahson commentedOn line 108 of Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemBase.php this is the line that produces the Exception Error..and I think what it says is that 'plugin_configuration' should be a key in the $configuration array. Is there a better way to solve this.
Comment #6
jonathanshawSeems like a serious problem.
Comment #7
bradjones1Fixing priority; needs more information on reliably replicating this.
Comment #8
Ujin CreditAttribution: Ujin as a volunteer and commentedI had the same issue applied this patch to fix it.
Comment #9
jonathanshaw@Ujin can you provide steps to reliably reproduce the problem?
Comment #10
Ujin CreditAttribution: Ujin as a volunteer and commented@jonathanshaw I have Drupal 8.7.1 and next contrib modules:
entity_reference_quantity
entity_reference_revisions
field_formatter_class
field_group
field_states_ui
libraries
page_load_progress
paragraphs
parallax_bg
pathauto
payment
payment_offsite_api
paypal_payment
plugin
And on every page I had in the bottom message about fatal error. I think will need to try with fresh installation in order to reproduce the issue.
Comment #11
bwoods CreditAttribution: bwoods at Johns Hopkins University commentedI had a similar problem because I didn't delete payment data before deleting the actual fields. I was able to resolve by deleting the "deleted" data/revision content and tables directly from the database.
Comment #12
valthebaldComment #13
valthebaldSteps to reproduce:
* Add plugin field to any content type
* Add a node, filling plugin information
* Delete the new field
* Run cron to purge the new field
* See the error in error log
Comment #14
valthebaldComment #15
tednacip CreditAttribution: tednacip commented@ stone_d
thank you !!
Comment #16
nginex CreditAttribution: nginex at Dropsolid for Dropsolid commentedReroll against the latest version 2.9
Comment #17
FrontmobeThis issue still occurs with the current version of the module (version 2.11). It seems to me it would be good to get the patch committed, especially since this issue has been around for 6 years now.
The current patch in #16 applies cleanly to version 2.11 of the module, the code looks good to me.
Is a test needed to get this committed?