diff --git a/core/core.services.yml b/core/core.services.yml index 2ae5157..1de7bcb 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -510,7 +510,7 @@ services: class: Drupal\Core\Routing\CachedUrlGenerator arguments: ['@url_generator.uncached', '@cache.url_generator', '@language_manager', '@router.route_provider'] calls: - - [fromRequestStack, ['@request_stack']] + - [prepareCache, ['@request_stack']] tags: - { name: needs_destruction } unrouted_url_assembler: diff --git a/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php b/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php index d42b400..7a75a7e 100644 --- a/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/CachedUrlGenerator.php @@ -189,9 +189,15 @@ protected function getRoute($name) { } /** - * {@inheritdoc} + * Based on the current request load the appropiate set of cached URLs. + * + * Any cache key algorithm must be sensitive the the case of the URL. + * For example '/MY/PAGE' and '/my/page' maybe routed to different controllers + * and so different caches may needed at this point. + * + * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack */ - public function fromRequestStack(RequestStack $requestStack) { + public function prepareCache(RequestStack $requestStack) { $this->cacheKey = $requestStack->getCurrentRequest()->attributes->get('_system_path'); if (!RequestHelper::isCleanUrl($requestStack->getCurrentRequest())){ $this->cacheKey .= '::' . $requestStack->getCurrentRequest()->getScriptName(); @@ -201,7 +207,8 @@ public function fromRequestStack(RequestStack $requestStack) { $this->cacheKey .= '::' . $this->languageManager->getCurrentLanguage(Language::TYPE_URL)->getId(); } - $this->cacheKey = sha1($this->cacheKey); + // Make cacheKeys sensitive to the case of the incomming URL. + $this->cacheKey = hash('md4', $this->cacheKey); $cached = $this->cache->get($this->cacheKey); if ($cached) {