Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow-up to #2492839: Views replacement token bc layer allows for Twig template injection via arguments
Problem/Motivation
% is a reserved indicator and can't start a token.
http://yaml.org/spec/1.2/spec.html#id2774228
Proposed resolution
Quote the value.
Remaining tasks
grumble about symfony's yaml parser/encoder.
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Comment | File | Size | Author |
---|---|---|---|
#7 | 2568415-6.interdiff.txt | 653 bytes | neclimdul |
#7 | 2492839_added_invalid-2568415-6.patch | 651 bytes | neclimdul |
#2 | 2492839_added_invalid-2568415-2.patch | 651 bytes | neclimdul |
Comments
Comment #2
neclimdulPatch.
Comment #3
joelpittet@neclimdul thank you. Do you know if our exporter will properly export it quoted?
Comment #4
neclimdulI don't actually, I assumed this was made with the exporter and that it wouldn't quote it hence the grumbling in the IS. If it was manually written, then maybe. I would guess most cases are probably going to be quoted anyways because they'll be longer and trigger some other check in Symfony. This case is short without spaces or anything and starts with the invalid character so it falls in a narrow use case that causes this problem.
Comment #5
mikeker CreditAttribution: mikeker as a volunteer commentedRound-tripped test_token_view and the exporter does correctly quote that value, though with single- instead of double-quotes (no escaped characters like "\n" in the string). It makes no difference in terms of parsing, but perhaps in terms of future diffs?
Comment #6
mikeker CreditAttribution: mikeker as a volunteer commentedSorry, x-posted with #4 because I'm trying to eat and post at the same time... :)
To clarify, I added that string in the original issue and did it by editing the existing file which @dawehner originally added so it may have not gone through the exporter... Also, this SO answer does a good job specifying when to use no-, single-, or double-quotes.
Comment #7
neclimdulYeah, I generally have been single quoting, I don't know what lead me to double quote this.
Bonus, what an interdiff!
Comment #8
mikeker CreditAttribution: mikeker as a volunteer commentedLove it when the interdiff is larger than the patch! :)
Comment #9
mikeker CreditAttribution: mikeker as a volunteer commentedComment #10
alexpottCommitted 7df9b06 and pushed to 8.0.x. Thanks!