Error when deleting a tablefield

Created on 14 November 2022, about 2 years ago
Updated 8 August 2024, 4 months ago

Problem/Motivation

Getting an error when I try to delete a table field - seems similar to https://www.drupal.org/project/tablefield/issues/3066535 โ†’

Drupal core 9.4.8
PHP 8.0
Tablefield 8.x-2.3

Steps to reproduce

1. Create a new content type.
2. Create a new field of type Table Field, leave settings as default.
3. Create a new node, it must have data entered into the table field, and save it.
4. Delete the field you created in step 2.

You will receive the error below. Now similar to the bug I marked as related, cron is broken as Drupal continues to try and delete this data.

TypeError: array_key_exists(): Argument #2 ($array) must be of type array, string given in array_key_exists() (line 175 of modules/contrib/tablefield/src/Plugin/Field/FieldType/TablefieldItem.php).
array_key_exists('caption', 'a:6:{i:0;a:5:{i:0;s:2:"13";i:1;s:1:"4";i:2;s:1:"5";i:3;s:0:"";i:4;s:0:"";}i:1;a:5:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";}i:2;a:5:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";}i:3;a:5:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";}i:4;a:5:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";i:3;s:0:"";i:4;s:0:"";}s:7:"caption";s:0:"";}') (Line: 175)
Drupal\tablefield\Plugin\Field\FieldType\TablefieldItem->setValue(Array, ) (Line: 208)
Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object, 0, Array) (Line: 82)
Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object, 0, Array) (Line: 41)
Drupal\Core\Field\FieldItemList->createItem(0, Array) (Line: 69)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, ) (Line: 107)
Drupal\Core\Field\FieldItemList->setValue(Array, ) (Line: 106)
Drupal\Core\TypedData\TypedDataManager->create(Object, Array, 'field_test_tabe', Object) (Line: 1685)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->readFieldItemsToPurge(Object, 10) (Line: 560)
Drupal\Core\Entity\ContentEntityStorageBase->purgeFieldData(Object, 10) (Line: 83)
field_purge_batch(10) (Line: 115)
Drupal\field_ui\Form\FieldConfigDeleteForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 592)
Drupal\Core\Form\FormBuilder->processForm('field_config_delete_form', Array, Object) (Line: 320)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
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}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
๐Ÿ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

๐Ÿ‡ฆ๐Ÿ‡บAustralia thomwilhelm Sydney

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

Merge Requests

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