Problem/Motivation
The bang ("!") placeholder for t() and format() has been removed in https://www.drupal.org/node/2575819 as a consequence of #2506427: [meta] !placeholder causes strings to be escaped and makes the sanitization API harder to understand, but LogMessageParser::parseMessagePlaceholders()
still accepts it and does not accept the new colon (":") placeholder for URLs.
Note: I put this in the dblog component because there's currently no logger subsystem defined in the issue queue, but there should probably be one (which I'd volunteer to maintain, BTW).
Steps to reproduce
Proposed resolution
The line reading:
if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === '!')) {
should probably read
if (!empty($key) && ($key[0] === '@' || $key[0] === '%' || $key[0] === ':')) {
instead.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#32 | interdiff_23-32.txt | 1.18 KB | pradhumanjain2311 |
#32 | 2617330-32.patch | 1.77 KB | pradhumanjain2311 |
#23 | interdiff_19-23.txt | 1.09 KB | Ratan Priya |
#23 | 2617330-23.patch | 1.74 KB | Ratan Priya |
#19 | 2617330-19.patch | 1.68 KB | mfb |
|
Comments
Comment #2
fgmLet's see what the existing tests says.
Comment #3
dawehnerRight, other ones would pass then to t() in Dblog, which is IMHO still crazy, but we do that.
Some simple test would be nice!
Comment #5
dagmar#2481349: Prevent the use of placeholders that cannot be converted into strings when creating logs here we have tests for this, test are not passing at this moment. Can we set this to duplicate and work on the other issue?
Comment #6
dawehner@dagmar
I'm a bit confused because this fix doesn't appear in the issue you linked to.
Comment #7
dagmar@dawehner Please take a look to comment #23 https://www.drupal.org/node/2481349#comment-10905482 and #27
Comment #9
guedressel CreditAttribution: guedressel at CYLEDGE commentedComment #11
dagmarThis still needs tests.
Comment #12
dagmarI'm closing this issue in favor of #2760031: Log messages won't appear translated if they have special characters in them which contains all the tests that this issue requires.
Comment #13
dagmarThis hasn't been fixed in 5 years. Let's provide a simple test that expose the issue and get someone write the patch. The patch that fixes this issue is in #2. We need to provide a combined patch with the test provided here and the fix provided in #2.
Comment #14
dagmarFixed some typos in the comment.
Comment #15
dagmarMore typos...
Comment #19
mfbI finally just stumbled into this bug, after noticing that two of my logger modules are not parsing message placeholders correctly (of course it also affects dblog and syslog modules).
Combining the test patch from #15 with the bug fix patch from #2
Comment #20
mfbI tested the patch with dblog, Drush logger and two contrib loggers; log messages with
<a href=":url">
now render correctly :) Marking this RTBC since I didn't write either parts of the patch; also fixing a typo in the issue summary.Comment #21
quietone CreditAttribution: quietone at PreviousNext commentedJust added template to the IS.
Comment #22
alexpottThis is not very clear. :placeholder is not removed.
I think it is okay to just remove the ! - I'm not sure that we need to support : - maybe it is best for consistency but we've survived this long without it...
I think this should read something like
// Test removal unexpected placeholders like ! while allowed placeholders beginning with @, % and : are preserved.
Comment #23
Ratan Priya CreditAttribution: Ratan Priya at OpenSense Labs commented@alexpott,
Made changes as per comment #22.
Needs review.
Comment #24
mfb@Ratan Priya can you wrap the long comment onto multiple lines at 80 characters? Also, the grammar is off - should be
Comment #25
fgmProbably off-topic, but it seems that Ratan rerunning the tests for my path removed credit for my creating it in the first place. Looks like a bug in drupal.org, does it not ?
Comment #26
hestenet@fgm - likely a bug introduced by: #3226881: Do not automatically credit people who upload files to an issue - we'll investigate
Comment #27
alexpottCrediting @fgm
Comment #28
alexpottThe comment should wrap at 80 characters. I will fix this if this patch is rtbc.
Comment #29
drumm@fgm - credit is not saved until a maintainer comments. They may update as they go, and should decide on final credit as the issue is fixed, credit is not complete until the issue is fixed. In this case, you were indeed first credited by #27. Maintainers had commented previously, so they did not choose to credit at the time. This could have been an explicit decision, or could have been the defaults at the time did not suggest crediting people who uploaded patches. Since this was seven years ago, and the system worked as alexpott has credited you, this is not worth spending any more time investigating.
Comment #30
dagmarNeeds work per #24 . This requires a minor grammar fix, and wrap the comment to 80 characters.
Comment #31
pradhumanjain2311 CreditAttribution: pradhumanjain2311 at OpenSense Labs commentedComment #32
pradhumanjain2311 CreditAttribution: pradhumanjain2311 at OpenSense Labs for DrupalFit commented@dagmar i made changes as per comment #24 needs review.
Comment #33
fgmRestored title damaged by previous comment.
Comment #34
dagmarThanks @pradhumanjainOSL According to https://www.drupal.org/docs/develop/standards/api-documentation-and-comm... use of
/* */
comments is ok but discouraged within functions.Maybe @alexpott wants to fix that as he mentioned in #28
Anyways this looks good.
Comment #37
alexpottBackported to 9.5.x as a low risk bug fix. Thanks!
Fixed code comments on commit.
Comment #39
alexpottDiscussed with @longwave we agreed to backport this to 9.4.x
Committed 59143d8 and pushed to 9.4.x. Thanks!