summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-10 11:40:33 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-10 11:40:33 -0400
commite105186172a34f4c3ba05af594e34dfa63083b72 (patch)
treebd949b90bceb238b5133197942cee47b740d7620 /includes
parent3c8b182b79850c497b24c79c1c3e56999b3da12a (diff)
downloadbrdo-e105186172a34f4c3ba05af594e34dfa63083b72.tar.gz
brdo-e105186172a34f4c3ba05af594e34dfa63083b72.tar.bz2
Issue #496170 by stefan.r, chx, Fabianx, jbrauer, David_Rothstein, roderik, rwohleb, pounard, kenorb, Jose Reyero, joelpittet, catch: module_implements() cache can be polluted by module_invoke_all() being called (in)directly prior to full bootstrap completion
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc5
-rw-r--r--includes/module.inc5
2 files changed, 10 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index ceac115a5..ef71ee8b6 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5212,6 +5212,11 @@ function _drupal_bootstrap_full() {
fix_gpc_magic();
// Load all enabled modules
module_load_all();
+ // Reset drupal_alter() and module_implements() static caches as these
+ // include implementations for vital modules only when called early on
+ // in the bootstrap.
+ drupal_static_reset('drupal_alter');
+ drupal_static_reset('module_implements');
// Make sure all stream wrappers are registered.
file_get_stream_wrappers();
// Ensure mt_rand is reseeded, to prevent random values from one page load
diff --git a/includes/module.inc b/includes/module.inc
index 076992ca9..7bf619b47 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -867,6 +867,11 @@ function module_hook_info() {
* @see module_implements()
*/
function module_implements_write_cache() {
+ // The list of implementations includes vital modules only before full
+ // bootstrap, so do not write cache if we are not fully bootstrapped yet.
+ if (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL) {
+ return;
+ }
$implementations = &drupal_static('module_implements');
if (isset($implementations['#write_cache'])) {
unset($implementations['#write_cache']);