Adding new classes and theme suggestions to custom blocks does not check for missing content

Created on 2 December 2023, 12 months ago
Updated 3 December 2023, 12 months ago

Problem/Motivation

After updating to v5.5.15, two sites I maintain were broken. Both sites somehow had custom blocks that were missing or contained no content. Upon investigation, two commits on November 28 (7a9260e2: Block custom type add class; 005a28fa: Block custom type theme suggestions) do not check if variable $block['block']['#block_content'] exists or is null, which is the case if the blocks are missing or have no content. Checking to make sure $block['block']['#block_content'] is set and is not null healed the broken sites.

Steps to reproduce

Not absolutely sure, but something like below.
Create custom block type and block of that type.
Delete custom block.

Proposed resolution

Check that $block['block']['#block_content'] is set and is not null.

Remaining tasks

Create patch that checks that $block['block']['#block_content'] is set and is not null before adding class and theme suggestions for custom blocks.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

5.5

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jlholmes Madison, WI

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

Comments & Activities

Production build 0.71.5 2024