Change record status: 
Project: 
Introduced in branch: 
11.x
Introduced in version: 
11.4.0
Description: 

As of Drupal 11.4.0, NULL values passed to @ and % placeholders in FormattableMarkup (and by extension TranslatableMarkup, logger calls, etc.) are now handled gracefully instead of throwing a fatal TypeError.

  • @ placeholders (plain text): NULL triggers a PHP notice, outputs empty string
  • % placeholders (emphasized): NULL triggers a PHP notice, outputs empty tag
  • : placeholders (URLs): NULL is silently converted to empty string — no notice (intentional, as NULL is a common legitimate value for optional URLs)

The PHP notice includes the placeholder key and the source string to help identify where the bad value is coming from:

Passing NULL as a placeholder value is not supported. Use an empty string instead. Placeholder: %directory, String: "The upload directory %directory could not be created or is not accessible.".

Action Required
No immediate action is required — your pages will no longer crash. However, the PHP notice will appear in your logs, and you should audit calling code to pass '' instead of NULL:

<?php
// Before: caused a fatal TypeError in older Drupal, now logs a notice
$destination = NULL;
\Drupal::logger('file')->notice('The upload directory %directory could not be created or is not accessible.', ['%directory' => $destination]);

// Recommended fix: use null coalescing to provide a meaningful fallback
\Drupal::logger('file')->notice('The upload directory %directory could not be created or is not accessible.', ['%directory' => $destination ?? '']);
Impacts: 
Module developers
Site templates, recipes and distribution developers