"Warning: Trying to access array offset on value of type null" when working with array config, such as TextFormat form elements

Created on 31 October 2023, 11 months ago

Problem/Motivation

When working with config with an array structure, such as form element TextFormat, this will cause a the message "Warning: Trying to access array offset on value of type null" in config_translation which expects keys inside the array.

Steps to reproduce

  1. Enable config_translation module
  2. Create a block plugin extending BlockBase.
  3. Add a text_format form element
  4. Be sure to add /mymodule/config/scheme/mymodule.schema.yml file with block.settings.* config, and set your field's type to "text_format"
  5. Add the block to a Layout Builder
  6. In the Layout Builder translation, click "Translate block"
  7. This should result a new warning in the db log

Proposed resolution

In TranslateBlockForm, when copying configuration array keys to translated config and setting value to NULL, the full array structure should be recursively replaced instead.

πŸ› Bug report
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kelly.m.jacobs

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

Comments & Activities

Production build 0.71.5 2024