During a pageload where the cache had been emptied just before, if a module is installed that calls module_implements(some_hook) before all modules that implement some_hook are loaded, only the then-loaded modules get cached by module_implements.

Subsequently, when all modules are loaded, drupal does not fix this cache, since the cache is no longer empty.

This causes modules like token to break utterly, since they rely on a module_implements_alter hook.

CommentFileSizeAuthor
flush-cache.patch557 byteshuf

Comments

catch’s picture

Version: 7.14 » 8.x-dev
Issue tags: +Needs backport to D7

Calling module_implements() before all modules are loaded isn't really supported, that's what bootstrap_invoke_all() is for.

On the other hand lots of code does unfortunately do this.

The easiest way to fix this would be to prevent module_implements() writing to cache if it has a cache miss before a full bootstrap, then the cache won't be corrupted. The ThemeRegistry class does this since similar problems can happen with early calls to theme(). We should also update the module_implements() cache to use DrupalCacheArray - or move the logic into the new Extensions class. the CacheArray conversion could be backported to 7.x.

Growiel’s picture

i wonder if this is the same problem as #1934192: hooks disappear from module_implements cache, maybe one module invokes module_implements "too early" and as such the other form_alter disapear.

catch’s picture

dcam’s picture

http://drupal.org/node/1427826 contains instructions for updating the issue summary with the summary template.

catch’s picture

Status: Active » Closed (duplicate)

This is fixed in 8.x.

#1934192: hooks disappear from module_implements cache is a Drupal 7 issue with more background, marking this as duplicate.