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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckaotik created an issue. See original summary.

ckaotik’s picture

Assigned: ckaotik » Unassigned
Status: Active » Needs review
FileSize
1007 bytes

I've added a single line patch, please review.

  • willzyx committed 019fa77 on 8.x-1.x authored by ckaotik
    Issue #2935906 by ckaotik: Session might not exist for rebuild theme...
willzyx’s picture

Status: Needs review » Fixed

@ckaotik Thanks! committed and pushed to 8.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.