Error when purging deleted tablefield - array_key_exists(): Argument #2 ($array) must be of type array, string given

Created on 7 March 2024, about 1 year ago

Problem/Motivation

The field purge cronjob fails when deleting non-empty tablefield fields.
After deleting the field values from the DB, the error does not occur.
I am unfamiliar with the process of removing/purging fields, other factors might be relevant, e.g. I had about 30 field values.

Steps to reproduce

(I'm afraid I don't have the time to double-check this now, but this is more-or less how it went)

  • Create a content entity type (message in my case) with a tablefield field.
  • Create some entities with data in the tablefield field
  • Remove the tablefield field
  • (I doubt that it's relevant, but at this point I exported the new config locally and imported in production.)
  • The field purge cron job (field_cron() -> field_purge_batch()) fails with an error

At some point during the purge the field is instantiated with its current value.
The setValue() method in TablefieldItem receives $values as:

[
'value' => "serialized table data",
'format' => "format",
'caption' => "caption",
];

and does not properly process it.
An error occurs in array_key_exists in the block

elseif (empty($values['rebuild'])) {

array_key_exists(): Argument #2 ($array) must be of type array, string given

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.4

Component

Code

Created by

🇭🇺Hungary karol haltenberger

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024