diff --git a/core/includes/utility.inc b/core/includes/utility.inc index 290821c..ff65dc8 100644 --- a/core/includes/utility.inc +++ b/core/includes/utility.inc @@ -15,14 +15,14 @@ /** * Rebuilds all caches even when Drupal itself does not work. * - * @param \Composer\Autoload\ClassLoader $classloader - * The classloader. + * @param \Composer\Autoload\ClassLoader $class_loader + * The class loader. * @param \Symfony\Component\HttpFoundation\Request $request * The current request. * * @see rebuild.php */ -function drupal_rebuild(ClassLoader $classloader, Request $request) { +function drupal_rebuild(ClassLoader $class_loader, Request $request) { // Remove Drupal's error and exception handlers; they rely on a working // service container and other subsystems and will only cause a fatal error // that hides the actual error. @@ -34,7 +34,7 @@ function drupal_rebuild(ClassLoader $classloader, Request $request) { PhpStorageFactory::get('twig')->deleteAll(); // Bootstrap up to where caches exist and clear them. - $kernel = new DrupalKernel('prod', $classloader); + $kernel = new DrupalKernel('prod', $class_loader); $kernel->setSitePath(DrupalKernel::findSitePath($request)); $kernel->prepareLegacyRequest($request); diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 9f8aaaa..8592402 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -108,7 +108,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { protected $storage; /** - * The classloader object. + * The class loader object. * * @var \Composer\Autoload\ClassLoader */ @@ -246,15 +246,17 @@ public static function createFromRequest(Request $request, $class_loader, $envir $response->prepare($request)->send(); } - // If the class loader is still the same, possibly upgrade to the APCu class + // If the class loader is still the same, possibly upgrade to the APC class // loader. if ($class_loader_class == get_class($class_loader) && Settings::get('class_loader_auto_detect', TRUE) + && Settings::get('hash_salt', FALSE) && function_exists('apc_fetch')) { - $prefix = 'drupal' . hash('sha-256', 'drupal.' . Settings::getHashSalt()); + $prefix = 'drupal.' . hash('sha256', 'drupal.' . Settings::getHashSalt()); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $class_loader); $class_loader->unregister(); $apc_loader->register(); + $class_loader = $apc_loader; } return $kernel; diff --git a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php index 03e56fc..070e990 100644 --- a/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php +++ b/core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php @@ -122,9 +122,9 @@ public function testCompileDIC() { $this->assertEqual(array_values($modules_enabled), $module_list); // Test that our synthetic services are there. - $classloader = $container->get('class_loader'); - $refClass = new \ReflectionClass($classloader); - $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a classloader'); + $class_loader = $container->get('class_loader'); + $refClass = new \ReflectionClass($class_loader); + $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a class loader'); // We make this assertion here purely to show that the new container below // is functioning correctly, i.e. we get a brand new ContainerBuilder @@ -150,9 +150,9 @@ public function testCompileDIC() { $this->assertTrue($container->has('service_provider_test_class'), 'Container has test service'); // Test that our synthetic services are there. - $classloader = $container->get('class_loader'); - $refClass = new \ReflectionClass($classloader); - $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a classloader'); + $class_loader = $container->get('class_loader'); + $refClass = new \ReflectionClass($class_loader); + $this->assertTrue($refClass->hasMethod('loadClass'), 'Container has a class loader'); // Check that the location of the new module is registered. $modules = $container->getParameter('container.modules'); diff --git a/core/rebuild.php b/core/rebuild.php index e89486f..598a408 100644 --- a/core/rebuild.php +++ b/core/rebuild.php @@ -20,7 +20,7 @@ // Change the directory to the Drupal root. chdir('..'); -// Clear the APCu cache to ensure APCu classloader is reset. +// Clear the APC cache to ensure APC class loader is reset. if (function_exists('apc_fetch')) { apc_clear_cache('user'); } diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 152e3a9..098025a 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -403,7 +403,7 @@ */ /* if ($settings['hash_salt']) { - $prefix = 'drupal.' . hash('sha-256', 'drupal' . $settings['hash_salt']); + $prefix = 'drupal.' . hash('sha256', 'drupal.' . $settings['hash_salt']); $apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $class_loader); unset($prefix); $class_loader->unregister();