Needs work
Project:
Drupal core
Version:
main
Component:
render system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2015 at 04:49 UTC
Updated:
20 Aug 2025 at 14:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
alexpottLet's see what breaks.
Comment #3
alexpottThe admin filtering of #description was added in #2324371: Fix common HTML escaped render #key values due to Twig autoescape
Comment #6
alexpottFixing the test fails. I think the fixes show that this is good idea.
Comment #9
alexpottFixing more fails and some @todos.
Comment #10
alexpottIntroducing
RenderVariableto produce not very nice looking render arrays.Comment #11
alexpottMore tests
Comment #13
stefan.r commentedDiscussed this with @dawehner - it may be fine, considering we autoescape elsewhere as well. Not autoescaping used to be inconvenient a year ago but we have better tools now. Also #description contains a t() string in most cases.
The problem is when we concatenate. This shows we need a helper function that helps concatenate and mark the resulting string as safe or not, santizing where needed.
One worry with this change is... this used work, and now we break it. Do we truly need to?
Comment #14
alexpottYes this is an api change - generally the worst that can happen is some escaped HTML where it's not supposed to be. But this does mean that the only special cased render variables are
#markup,#prefix,#suffix,#field_prefixand#field_suffix. Which are all similar - the outlier is#description. Even the fact that it is touched at all inRenderershould ring alarm bells.Comment #15
lauriiiIn order to make the API more user friendly, we have to remove as many special cases as possible. We want to teach people to use #markup, #prefix and #suffix if they need to print some static HTML from PHP. What does #description do with that? For me it seems like #description doesn't belong to that list because its trying to solve special use case, and the other render variables are general solutions for printing markup.
Comment #16
alexpott@lauriii nice comment that sums it up well.
However doing this patch will make #2571935: Fix use of !placeholder for imploding in views.views.inc harder because then we'll have to mark the result of concatenating everything together as safe somehow.
Comment #17
lauriiiI know this is a weird suggestion but I'd suggest to postpone this till #2571935: Fix use of !placeholder for imploding in views.views.inc is in and then we could discover how to fix the concatenating in this issue. That way we wouldn't make solving criticals any harder :)
Comment #18
lauriiiComment #24
alexpottDiscussed with @xjm, @Cottser, @joelpittet and @laurii. All things should autoescape, support translatable markup, support render arrays. We need to add documentation of the sanitisation behaviour of ALL render elements (and workarounds to change them) to the scope of the docs meta. I proposed resolution to add version key to render arrays as a separate 8.x issue.
Comment #25
alexpottCreated #2722747: Discuss being able to version render API to discuss a possible way to achieve this in D8
Comment #36
xjmComment #39
smustgrave commentedThis came up as a daily BSI target
This definitely appears to be relevant, from checking a few of the
['#description']instances in core.This will need an issue summary update but @alexpott would you say this also just needs a reroll?