Problem/Motivation
User deprecated function: Invalid placeholder (uid) in string: During rendering of embedded media: the media item with UUID "@uuid" does not exist. in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 244 of core/lib/Drupal/Component/Render/FormattableMarkup.php).
This occurs when the placeholder is found in the copy in this case 'uid' is found but not allowed as a placeholder.
Steps to reproduce
Embed a remote video, delete the video, visit the page.
Proposed resolution
Prefix all placeholders (or remove)
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3169832-8.patch | 2.53 KB | joelpittet |
Comments
Comment #2
joelpittetHere's a possible solution, all the message arguments that are not valid are stripped out before they cause problems for
FormattableMarkupComment #3
joelpittetComment #4
abu-zakham commentedComment #5
abu-zakham commentedThank you joelpittet,
I'll remove errorlog/errorlog.info.yml changes, I think it's added by mistake, you don't have to create a new patch
Can you please explain how to reproduce this issue?
Comment #6
joelpittet@abu-zakham Yes total mistake, I didn't have my project using the dev branch and copied the files changed/fixed.
So to reproduce this you just need to trigger a message that has
uidthe the text. In the issue summary I referenced where I saw it which was locally I don't have a media entity that was being embedded, so it triggered$this->loggerFactory->get('media')->error('During rendering of embedded media: the media item with UUID "@uuid" does not exist.', ['@uuid' => $uuid]);That is my hypothesis of what's going on at least... I was involved in FormattableMarkup's creation from format_string(), so you can blame me for this issue ;)
Comment #7
joelpittetSomething like this should trigger it if my theory is correct:
\Drupal::logger('emaillog')->error('A string "uid" should not throw an invalid placeholder error: %test', ['%test' => 'Test']);Comment #8
joelpittetRemoving the info.yml diff that snuck in there ;)
Comment #9
joelpittetBump since there was a new release
Comment #10
joelpittetI guess the alternative is that the function can be a little more discerning which variables are passed along...
Comment #12
poker10 commentedI have tested this and the code removed unwanted placeholders. As a most straightforward fix looks good to me. Committed and pushed, thanks!