Provide cache context for UserCountry condition

Created on 12 April 2023, over 1 year ago
Updated 3 June 2024, 7 months ago

Problem/Motivation

When adding a condition, it would be great to additionally have a cache context available.

Proposed resolution

Review MR and commit.

Feature request
Status

Needs work

Version

5.0

Component

Code

Created by

🇦🇹Austria attisan Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @attisan
  • @attisan opened merge request.
  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work 7 months ago
  • 🇮🇹Italy kimlop

    the following error occurs with Drupal 10.2.6 and php8.2:

    Deprecated function: sha1(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\smart_ip\CacheContext\CountryCodeCacheContext->getContext() (line 47 of modules/contrib/smart_ip/src/CacheContext/CountryCodeCacheContext.php).
    Drupal\smart_ip\CacheContext\CountryCodeCacheContext->getContext(NULL) (Line: 123)
    Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys(Array) (Line: 244)
    Drupal\Core\Cache\VariationCache->createCacheIdFast(Array, Object) (Line: 179)
    Drupal\Core\Cache\VariationCache->getRedirectChain(Array, Object) (Line: 35)
    Drupal\Core\Cache\VariationCache->get(Array, Object) (Line: 142)
    Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onRequest(Object, 'kernel.request', Object)
    call_user_func(Array, Object, 'kernel.request', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 157)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Production build 0.71.5 2024