Overview

BlockRenderConverter::applies() passes #theme to str_starts_with(), but #theme can be an array. Forms always have one (FormBuilder sets ['<form_id>']), so any page containing a form fails with a 500:

TypeError: str_starts_with(): Argument #1 ($haystack) must be of type string, array given

To reproduce: view the draft of a moderated node through Canvas Headless's json-render output as a user who can change its state. The content moderation form on the page triggers the error.

Proposed resolution

Cast #theme to an array and match if any entry is block or starts with block_.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Status: Active » Needs review