As a result of #936234: call to router during menu access check causes infinite loop there are some cases where when you are on a page that uses an admin theme, it will revert back to the default theme. This is related to the core bug #219910: Calling theme function from hook_init() interferes with administration theme, but it seems highly unlikely anything will be done to core related to this.

The problem only happens when the theme function is called from within hook_init. This is probably a rare case, but here is my scenario where this happens:

1. Purl, Spaces, Spaces OG, and Syslog are enabled
2. Have a page under admin* where I edit a group node (and I use an admin theme that is different from the default theme)

What happens is spaces_router is called, which figures out that admin* is an excluded path. Then it calls purl_goto to remove the purl modifier if it exists in the URL. However, it doesn't exist, so within purl_goto it realizes that it is just going to redirect to the same URL, so it calls watchdog and returns without a redirect. The call to watchdog gets down to syslog_watchdog, which calls theme('syslog_format', ...) and that is where the problem is. When the page loads, it loads the default theme instead of the admin theme. If there are other modules enabled that call a theme() function within hook_watchdog, the same thing would happen.

CommentFileSizeAuthor
#1 spaces-purl_goto-1472176-1.patch747 bytesbdlangton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bdlangton’s picture

Status: Active » Needs review
FileSize
747 bytes

Here is what I think would be a simple fix to the problem. In deactivate() just check if the purl modifier is there. If it isn't, then there is no need to call purl_goto().

dealancer’s picture