Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given

Created on 8 August 2024, 9 months ago
Updated 19 September 2024, 7 months ago

Problem/Motivation

When visiting the node add form of a newly created node type in Drupal 11, the following error appears:

Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given

Steps to reproduce

  1. Create a new node type
  2. Visit the node create form of the new type

Proposed resolution

I was able to trace the root of the issue to the following snippet in the PageRedirect class:

$bundle_settings = $this->getBundleSettings($entity);
$bundle_fallback = $bundle_settings->get('redirect_fallback_action');
$fallback_options['bundle_default'] = $this->t('Global @bundle fallback (@setting)', [
    '@bundle' => $args['@bundle'],
    '@setting' => $bundle_fallback,
]);

$bundle_fallback is NULL, which causes this error down the line.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

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