diff --cc core/includes/bootstrap.inc index fbf098e,8c96031..0000000 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@@ -1451,8 -1408,8 +1408,8 @@@ function _current_path($path = NULL) * The relative path to the Drupal component in the filesystem. */ function drupal_classloader_register($name, $path) { - $loader = drupal_classloader(); + $loader = \Drupal::service('class_loader'); - $loader->addPsr4('Drupal\\' . $name . '\\', DRUPAL_ROOT . '/' . $path . '/src'); + $loader->addPsr4('Drupal\\' . $name . '\\', \Drupal::root() . '/' . $path . '/src'); } /** diff --cc core/includes/install.core.inc index 2941176,f49b521..0000000 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@@ -286,7 -286,8 +286,8 @@@ function install_begin_request(&$instal } $site_path = DrupalKernel::findSitePath($request, FALSE); - Settings::initialize(dirname(dirname(__DIR__)), $site_path); + $class_loader = require __DIR__ . '/../vendor/autoload.php'; - Settings::initialize($site_path, $class_loader); ++ Settings::initialize(dirname(dirname(__DIR__)), $site_path, $class_loader); // Ensure that procedural dependencies are loaded as early as possible, // since the error/exception handlers depend on them. diff --cc core/lib/Drupal/Core/DrupalKernel.php index dfc8438,7a303a2..0000000 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@@ -192,12 -192,12 +192,13 @@@ class DrupalKernel implements DrupalKer * @param bool $allow_dumping * (optional) FALSE to stop the container from being written to or read * from disk. Defaults to TRUE. + * * @return static */ - public static function createFromRequest(Request $request, ClassLoader $class_loader, $environment, $allow_dumping = TRUE) { + public static function createFromRequest(Request $request, $class_loader, $environment, $allow_dumping = TRUE) { // Include our bootstrap file. - require_once dirname(dirname(dirname(__DIR__))) . '/includes/bootstrap.inc'; + $core_root = dirname(dirname(dirname(__DIR__))); + require_once $core_root . '/includes/bootstrap.inc'; $kernel = new static($environment, $class_loader, $allow_dumping); @@@ -205,9 -205,7 +206,9 @@@ static::bootEnvironment(); // Get our most basic settings setup. - $kernel->initializeSettings($request); + $site_path = static::findSitePath($request); + $kernel->setSitePath($site_path); - Settings::initialize(dirname($core_root), $site_path); ++ Settings::initialize(dirname($core_root), $site_path, $class_loader); // Redirect the user to the installation script if Drupal has not been // installed yet (i.e., if no $databases array has been defined in the diff --cc core/lib/Drupal/Core/Site/Settings.php index 1e79767,def307f..0000000 --- a/core/lib/Drupal/Core/Site/Settings.php +++ b/core/lib/Drupal/Core/Site/Settings.php @@@ -85,12 -85,16 +85,18 @@@ final class Settings /** * Bootstraps settings.php and the Settings singleton. * + * @param string $app_root + * The app root. * @param string $site_path * The current site path. + * @param \Composer\Autoload\ClassLoader $class_loader + * The class loader that is used for this request. Passed by reference and + * exposed to the local scope of settings.php, so as to allow it to be + * decorated with Symfony's ApcClassLoader, for example. + * + * @see default.settings.php */ - public static function initialize($app_root, $site_path) { - public static function initialize($site_path, &$class_loader) { ++ public static function initialize($app_root, $site_path, &$class_loader) { // Export these settings.php variables to the global namespace. global $base_url, $cookie_domain, $config_directories, $config; $settings = array(); diff --cc core/modules/simpletest/src/InstallerTestBase.php index e7cfc95,90f318b..0000000 --- a/core/modules/simpletest/src/InstallerTestBase.php +++ b/core/modules/simpletest/src/InstallerTestBase.php @@@ -140,7 -138,8 +140,8 @@@ abstract class InstallerTestBase extend // Import new settings.php written by the installer. $request = Request::createFromGlobals(); - Settings::initialize($this->container->getParameter('app.root'), DrupalKernel::findSitePath($request)); - $class_loader = require DRUPAL_ROOT . '/core/vendor/autoload.php'; - Settings::initialize(DrupalKernel::findSitePath($request), $class_loader); ++ $class_loader = require $this->container->getParameter('app.root') . '/core/vendor/autoload.php'; ++ Settings::initialize($this->container->getParameter('app.root'), DrupalKernel::findSitePath($request), $class_loader); foreach ($GLOBALS['config_directories'] as $type => $path) { $this->configDirectories[$type] = $path; } @@@ -151,8 -150,8 +152,8 @@@ // directory has to be writable. // WebTestBase::tearDown() will delete the entire test site directory. // Not using File API; a potential error must trigger a PHP warning. -- chmod(DRUPAL_ROOT . '/' . $this->siteDirectory, 0777); - $this->kernel = DrupalKernel::createFromRequest($request, drupal_classloader(), 'prod', FALSE); ++ chmod($this->container->getParameter('app.root') . '/' . $this->siteDirectory, 0777); + $this->kernel = DrupalKernel::createFromRequest($request, $class_loader, 'prod', FALSE); $this->kernel->prepareLegacyRequest($request); $this->container = $this->kernel->getContainer(); $config = $this->container->get('config.factory'); diff --cc core/modules/simpletest/src/WebTestBase.php index 80f935c,e7c1875..0000000 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@@ -861,14 -861,15 +861,15 @@@ abstract class WebTestBase extends Test // Since Drupal is bootstrapped already, install_begin_request() will not // bootstrap into DRUPAL_BOOTSTRAP_CONFIGURATION (again). Hence, we have to // reload the newly written custom settings.php manually. - Settings::initialize(DRUPAL_ROOT, $directory); + $class_loader = require DRUPAL_ROOT . '/core/vendor/autoload.php'; - Settings::initialize($directory, $class_loader); ++ Settings::initialize(DRUPAL_ROOT, $directory, $class_loader); // Execute the non-interactive installer. require_once DRUPAL_ROOT . '/core/includes/install.core.inc'; install_drupal($parameters); // Import new settings.php written by the installer. - Settings::initialize(DRUPAL_ROOT, $directory); - Settings::initialize($directory, $class_loader); ++ Settings::initialize(DRUPAL_ROOT, $directory, $class_loader); foreach ($GLOBALS['config_directories'] as $type => $path) { $this->configDirectories[$type] = $path; } diff --cc core/rebuild.php index 9b704e7,c915aff..0000000 --- a/core/rebuild.php +++ b/core/rebuild.php @@@ -25,7 -25,7 +25,7 @@@ $request = Request::createFromGlobals() // Manually resemble early bootstrap of DrupalKernel::boot(). require_once __DIR__ . '/includes/bootstrap.inc'; DrupalKernel::bootEnvironment(); - Settings::initialize(dirname(__DIR__), DrupalKernel::findSitePath($request)); -Settings::initialize(DrupalKernel::findSitePath($request), $autoloader); ++Settings::initialize(dirname(__DIR__), DrupalKernel::findSitePath($request), $autoloader); if (Settings::get('rebuild_access', FALSE) || ($request->get('token') && $request->get('timestamp') &&