diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 2ddc3ee..5fe4287 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -975,7 +975,14 @@ protected function initializeSettings(Request $request) { if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) && function_exists('apc_fetch')) { - $prefix = Settings::getApcuPrefix('class_loader', $this->root); + // We need a file path to a class which should be in the vendor directory, + // so that we can modify our APC identifier hash with it. We do this so + // that if someone moves the vendor directory, ApcClassLoader won't fail + // to load the classes contained within it. We use the path to the Request + // class because we know the classloader has already found it. + // @todo: Consider removing this after https://www.drupal.org/node/2380389 + $request_class_path = $this->classLoader->findFile('Symfony\Component\HttpFoundation\Request'); + $prefix = Settings::getApcuPrefix('class_loader', $this->root, $request_class_path); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader); $this->classLoader->unregister(); $apc_loader->register(); diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php index 21298b4..5a972dc 100644 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@ -161,9 +161,14 @@ public static function getHashSalt() { * module directories setting apcu_ensure_unique_prefix would allow the sites * to share APC cache items. * - * @param $identifier + * @param string $identifier * An identifier for the prefix. For example, 'class_loader' or * 'cache_backend'. + * @param string $root + * The root directory of the Drupal installation. + * @param string $site_path + * (optional) The multisite site path, useful for SimpleTest. Can be an + * arbitrary string as well. Defaults to an empty string. * * @return string * The prefix for APC user cache keys.