- Issue created by @solideogloria
- Status changed to Needs review
about 1 month ago 7:12pm 28 May 2024
Visit /user/logout
while masquerading.
LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Ensure you are not rendering content too early. Returned object class: Drupal\Core\Routing\TrustedRedirectResponse. in Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (line 154 of .../web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php).
The cause is this code in MasqueradeLogLogger::log()
:
// For loggers that are not supporting HTML markup (e.g Syslog), the <p>
// tag will be stripped out but we ensure a leading space, so that there's
// still a delimiter from the main message.
$path = Url::fromRoute('user.page')->toString();
Replace with:
// For loggers that are not supporting HTML markup (e.g Syslog), the <p>
// tag will be stripped out but we ensure a leading space, so that there's
// still a delimiter from the main message.
$path = Url::fromRoute('user.page')->toString(TRUE)->getGeneratedUrl();
See https://drupal.stackexchange.com/a/187094
Needs review
1.0
Code