Problem/Motivation
When using the " Rebuild the theme registry on every page load" feature in combination with "Access developer information" permission for anonymous users, I occasionally run into an Exception caused by the theme rebuild info message. In those cases, the session does not exist on the request - maybe due to sub-requests or some request altering code.
Error: Call to a member function has() on null in Drupal\devel\EventSubscriber\ThemeInfoRebuildSubscriber->triggerWarningIfNeeded() (line 99 of /srv/www/htdocs/eposs-dev.w21.it/html/modules/dev/devel/src/EventSubscriber/ThemeInfoRebuildSubscriber.php)
Proposed resolution
Check if the session exists before trying to use it in Drupal\devel\EventSubscriber\ThemeInfoRebuildSubscriber::triggerWarningIfNeeded
:
if ($session && !$session->has($this->notificationFlag)) { /* ... */ }
Remaining tasks
Review patch.
Comment | File | Size | Author |
---|---|---|---|
#2 | devel-rebuild_session_might_not_exist-2935906-2.patch | 1007 bytes | ckaotik |
|
Comments
Comment #2
ckaotikI've added a single line patch, please review.
Comment #4
willzyx CreditAttribution: willzyx commented@ckaotik Thanks! committed and pushed to 8.x