diff -u b/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php --- b/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -125,7 +125,7 @@ /** * Initializes the full theme registry. * - * @return + * @return mixed[] * An array with the keys of the full theme registry, but the values * initialized to NULL. */ @@ -151,14 +151,18 @@ * {@inheritdoc} */ public function get($key) { + // When storage is not set get the storage. + if (!$this->storage) { + $this->getStorage(); + } + // If the offset is set but empty, it is a registered theme hook that has // not yet been requested. Offsets that do not exist at all were not // registered in hook_theme(). - $storage = $this->getStorage(); - if (isset($storage[$key])) { - return $storage[$key]; + if (isset($this->storage[$key])) { + return $this->storage[$key]; } - elseif (array_key_exists($key, $storage)) { + elseif (array_key_exists($key, $this->storage)) { return $this->resolveCacheMiss($key); } } diff -u b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php --- b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/RegistryTest.php @@ -66,6 +66,11 @@ */ protected $themeManager; + /** + * The request stack. + * + * @var \Symfony\Component\HttpFoundation\RequestStack|\PHPUnit_Framework_MockObject_MockObject + */ protected $requestStack; /**