Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta17
Description: 

The first argument of t() / TranslatableMarkup() ($string) should never be a variable, i.e. t($variable), and instead should always be a string, for various reasons:

  • potx can not scan this
  • With locale enabled we potentially translate already translated strings, or end up with dynamic data in locale, which results in a really big locale table
  • It is a security risk if it contains user input

In Drupal 8 there is also the risk that we pass in objects if we pass in a variable.

#2570285: Make sure TranslatableMarkup accepts string values only ensures that we no longer accidentally pass in objects (not even if they have a __toString magic method). It throws an exception if $string is not a string.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done