Quantcast
Viewing all articles
Browse latest Browse all 295617

Change String::format()'s '@' and '%' placeholders to be auto-escaped rather than always-escaped

Problem/Motivation

  • Now that we have SafeMarkup::escape(), which has more intelligence than String::checkPlain(), there's no reason not to use it within String::format().
  • Doing so will allow '@' to be safely used for variables containing HTML without double-escaping.

Proposed resolution

See issue title and patch.

Remaining tasks

Review. Commit.

User interface changes

None.

API changes

Only a break for people who were passing already-escaped text/HTML as @ or % placeholder values and wanting that to get double-escaped. This is unlikely. Such places will now need to call String::checkPlain() themselves on those placeholders to achieve that double-escaping.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryTask because D7 always escaped these placeholders, so it's not yet been decided to do otherwise.
Issue priorityMajor because it allows easy fixing of many double-escaping bugs left throughout Drupal.
DisruptionOnly disruptive for modules that are passing already escaped text and wanting it to get double escaped. They now need to be more explicit about wanting that.

Viewing all articles
Browse latest Browse all 295617


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>