Needs review
Project:
Drupal core
Version:
main
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Aug 2026 at 11:39 UTC
Updated:
18 Aug 2026 at 07:06 UTC
Jump to comment: Most recent
DrupalConsoleLogger::log() passes $message to strtr() without casting it to string. PSR-3 allows Stringable messages. TranslatableMarkup is one. That causes:
TypeError: strtr(): Argument #1 ($string) must be of type string, Drupal\Core\StringTranslation\TranslatableMarkup
\Drupal::logger('test')->warning(new TranslatableMarkup('Value %v is invalid.'), ['%v' => 'x']);
Cast $message to string before placeholder replacement.
| Comment | File | Size | Author |
|---|---|---|---|
| core-03-console-logger-stringable-message.patch | 906 bytes | luigisa |
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
Comment #2
luigisa commentedComment #3
smustgrave commentedFixes need to be in MRs and as a bug test coverage
Comment #4
quietone commentedHi, thanks for the issue and the patch! Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.
If AI was used in any way to created the issue or the fix The Drupal policy is that the use must be stated on the issue. Refer to the policy on the use of AI when contributing to Drupal includes that the use of AI must be disclosed.
The needs an MR to be ready for review.
Comment #5
quietone commentedUpdating the title per Title guidelines.
Comment #7
luigisa commentedComment #8
luigisa commentedComment #9
smustgrave commentedCan we extend an existing test vs adding a new one. Also can the AI verbosness be cleaned up and written in your own wording?
Comment #10
luigisa commentedComment #11
luigisa commentedMoved the coverage into ConsoleTest instead of a new test class. Also trimmed the comments and the issue summary.
Thanks @smustgrave for your comment
Comment #12
luigisa commented