Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
user.module
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Sep 2015 at 06:24 UTC
Updated:
2 Oct 2015 at 19:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dawehnerComment #3
alexpottComment #4
dawehnerI guess this issue is about the following.
Comment #5
lauriiiWorking on the tests that might be needed here
Comment #6
lauriiiComment #7
alexpottThis is part of the critical meta.
Comment #8
dawehnerShould we not also have something like $this->t('Managed file Example') and ensure its not double escaped?
Comment #9
lauriiiComment #10
lauriii@dawehner suggested on irc to use t() and test that the markup is not being escaped instead
Comment #11
stefan.r commentedIn the conversion we want to figure if a) $element['#title'] might already already be (partly) escaped under any circumstances and if b) it's passing in unsafe content that is marked as safe and bypasses escaping.
As to a), #title is wrapped in t(), so ought to by pass escaping, and b) would only happen when a contrib developer does something silly.
So the solution seems fine and the general idea behind the test as well... just some comments about the test itself:
$this->t('Managed <em>@name</em>', ['@name' => 'file'])is equivalent to$this->t('Managed <em>file</em>' as there is nothing to escape which may be a bit confusing to someone reading the test. I like the idea of using yet another placeholder for the test though, so maybe we could think of a slightly more realistic test case thanManaged <em>@name</em>? I don't think we need to be supporting markup in there, it's just quotes and ampersands that are a worry?Comment #12
dawehnerComment #13
stefan.r commentedHaha :)
As to the code comment, I was referring to the other "@name" (we have one one in the title itself and another one in the placeholder value) i.e. explaining there why double escaping is not a worry.
Comment #14
stefan.r commentedSo like this...
Anyway, I think #12 was RTBC, this just adds that comment.
Comment #15
lauriiiNit: here could be on the previous line, can be fixed on commit ;)
Comment #16
stefan.r commentedSo why do we think they were using !placeholder anyway? Currently, as long as the label is wrapped in t(), "@" ought to be always fine?
Comment #17
stefan.r commentedComment #18
stefan.r commentedI don't thinkk #title is a machine name (as in a-z0-9_)?
Comment #19
xjm@stefan.r, re #16, that was for a different issue (the field size one, which doesn't seem to have its own issue yet). See #2566503-9: [meta] Replace remaining !placeholder for Non-URL HTML outputs only.6.
+1 for the added comment explaining the expectations for the assertions.
+1 for the added test coverage.
Sounds delicious.
Nice patch all around.
I think @alexpott had done some research on/fighting with
#titleelements as well as entity labels, but I did not locate the relevant issues. So I asked @alexpott to comment on the issue or to revert the patch if it's problematic. But it looks thorough to me, so committed and pushed to 8.0.x.