diff --git a/src/PathProcessor/PurlContextOutboundPathProcessor.php b/src/PathProcessor/PurlContextOutboundPathProcessor.php index 8a0950c..512b1ec 100644 --- a/src/PathProcessor/PurlContextOutboundPathProcessor.php +++ b/src/PathProcessor/PurlContextOutboundPathProcessor.php @@ -28,13 +28,13 @@ public function __construct(MatchedModifiers $matchedModifiers, ContextHelper $c public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { - if (array_key_exists('purl_context', $options) && $options['purl_context'] == false) { + if (count($this->matchedModifiers->getMatched()) && $bubbleable_metadata) { + $cacheContexts = $bubbleable_metadata->getCacheContexts(); + $cacheContexts[] = 'purl'; + $bubbleable_metadata->setCacheContexts($cacheContexts); + } - if (count($this->matchedModifiers->getMatched()) && $bubbleable_metadata) { - $cacheContexts = $bubbleable_metadata->getCacheContexts(); - $cacheContexts[] = 'purl'; - $bubbleable_metadata->setCacheContexts($cacheContexts); - } + if (array_key_exists('purl_context', $options) && $options['purl_context'] == false) { return $this->contextHelper->processOutbound( $this->matchedModifiers->createContexts(Context::EXIT_CONTEXT),