Custom content entity with content moderation PHP Warning: array_flip(): Can only flip STRING and INTEGER values!

Created on 1 February 2023, almost 2 years ago
Updated 3 February 2023, almost 2 years ago

Problem/Motivation

First noticed on bibcite references, and confirmed on simple custom content entity.

Steps to reproduce

Enable content moderation module, and update workflow to include custom entity (allow bundles on it).
Create custom entity with draft state, save it. Then publish it. Once published, edit again and set draft as moderation state.
There will be PHP Warning: array_flip(): Can only flip STRING and INTEGER values!

Proposed resolution

Make sure latest revision id is not null before trying to load it. This means wrapping one line with if statement.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇨🇦Canada igorbiki

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

Comments & Activities

Production build 0.71.5 2024