Log messages won't appear translated if they have special characters in them

Created on 3 July 2016, over 8 years ago
Updated 1 March 2023, almost 2 years ago

Problem/Motivation

todo

Steps to reproduce

Todo

Proposed resolution

todo

Remaining tasks

Update issue summary.
Review code
Manual test
Commit

User interface changes

Translation on log messages page

API changes

NA

Data model changes

NA

Release notes snippet

NA

Original Post

I haven't tested this, but @hgoto has done some equivalent testing on a Drupal 7 patch that would have done what Drupal 8 does now (see #2459339: Log messages should be XSS filtered on display ) and the problem occurred then.

Because https://api.drupal.org/api/drupal/core%21modules%21dblog%21src%21Control... does this:

$message = $this->t(Xss::filterAdmin($row->message), unserialize($row->variables));

It suggests that if the message has any characters which get altered by Xss:filterAdmin() (such as <, > or &) then the message won't be properly translated, and the entire message will appear in English when viewing the logs even when the site is being viewed in a different language.

The solution of running Xss::filterAdmin() on the result of $this->t() instead was discussed in the above issue. It was rejected at the time, but I'm not sure the reasons for rejecting it are relevant anymore. Doing that should fix this.

@hgoto has an initial Drupal 8 patch for this at #2459339-29: Log messages should be XSS filtered on display

🐛 Bug report
Status

Needs work

Version

10.1

Component
Database Logging 

Last updated 3 months ago

Created by

🇺🇸United States David_Rothstein

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024