Diff and form data field types can't handle null bytes

Created on 6 February 2024, 9 months ago
Updated 7 February 2024, 9 months ago

Problem/Motivation

The fields diff and form_data</cod> of the <code>elog entity are of type string_long: https://git.drupalcode.org/project/elogger/-/blob/1.x/src/Entity/Elog.php.

This field type is unsuitable for strings created by the PHP serialize method because it may contain null bytes: https://www.php.net/manual/en/function.serialize.php.

This causes the saved field in the database to be cut off and not be able to be unserialized.

Steps to reproduce

This problem occurs for the diff field if a field label is an instance of TranslatableMarkup which happens fairly often.

Proposed resolution

Use MapItem. This field type is designed for storing serialized data and does therefore use the BLOB database type.

Data model changes

The entity schema must be changed.

Remaining tasks

  • Implement database migration
    • field type/database schema
    • view config
    • remove broken values in database
🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇩🇪Germany tgauges

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