fix: Ensure messages in DrupalConsoleLogger are cast to string for...

fix: Ensure messages in DrupalConsoleLogger are cast to string for compatibility with strtr() and placeholder parsing

[Added a type cast to string for log messages in DrupalConsoleLogger to handle Stringable messages correctly. Introduced unit tests to verify logging behavior with both string messages and TranslatableMarkup instances.

Closes #3616478](https://www.drupal.org/project/drupal/issues/3616478

DrupalConsoleLogger::log() passed $message to the placeholder parser and to strtr(). PSR-3 allows Stringable messages. TranslatableMarkup is one such object. strtr() requires a string, so a TranslatableMarkup message produced a TypeError.

This change casts $message to string before parsing and replacing placeholders.

A unit test covers log() with a TranslatableMarkup message and placeholders in $context. It also covers string messages with and without placeholders.

Generated with the help of an LLM.)

Merge request reports

Loading
Loading