Multiple warnings while clearing the cache

Created on 8 March 2021, over 3 years ago
Updated 1 January 2024, 11 months ago

Problem/Motivation

Multiple warnings while clearing the cache

Steps to reproduce

Enable bat_api on Drupal 9.1.5, clear cache or run drush cr.

With bat_api enabled multiple warnings are logged while clearing the cache:

Warning: assert(): assert(strpos($data_type, 'entity:') !== 0 || $this instanceof EntityContextDefinition) failed in Drupal\Core\Plugin\Context\ContextDefinition->__construct() (Zeile 112 in /var/www/dghi/drupal/web/core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php).

This warning is given for any entity context definition, for example:

array:36 [▼
  "35: assert()" => array:1 [▼
    "args" => array:2 [▼
      0 => false
      1 => "assert(strpos($data_type, 'entity:') !== 0 || $this instanceof EntityContextDefinition)"
    ]
  ]
  "34: Drupal\Core\Plugin\Context\ContextDefinition->__construct()" => array:2 [▼
    "file" => "core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php:112"
    "args" => array:2 [▼
      0 => "entity:bat_type_group_bundle"
      1 => Drupal\Core\StringTranslation\TranslatableMarkup {#8716 ▼
        #translatedMarkup: null
        #options: []
        #stringTranslation: Drupal\webprofiler\StringTranslation\TranslationManagerWrapper {#5809 ▶}
        #string: "@label"
        #arguments: array:1 [▼
          "@label" => Drupal\Core\StringTranslation\TranslatableMarkup {#3215 ▼
            #translatedMarkup: null
            #options: []
            #stringTranslation: null
            #string: "Type Group Bundle"
            #arguments: []
          }
        ]
      }
    ]
  ]
  "33: Drupal\services\Plugin\Deriver\EntityGet->getDerivativeDefinitions()" => array:2 [▼
    "file" => "modules/contrib/services/src/Plugin/Deriver/EntityGet.php:24"
    "args" => array:1 [▼
      0 => array:7 [▼
        "response_code" => 200
        "id" => "entity_get"
        "methods" => array:1 [▼
          0 => "GET"
        ]
        "translatable" => true
        "deriver" => "\Drupal\services\Plugin\Deriver\EntityGet"
        "class" => "Drupal\services\Plugin\ServiceDefinition\EntityGet"
        "provider" => "services"
      ]
    ]
  ]
  "32: Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives()" => array:2 [▶]
  "31: Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()" => array:1 [▶]
  "30: Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()" => array:1 [▶]
  "29: Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()" => array:1 [▶]
  "28: Drupal\Core\Plugin\DefaultPluginManager->getDefinition()" => array:2 [▶]
  "27: Drupal\Core\Plugin\DefaultPluginManager->hasDefinition()" => array:2 [▶]
  "26: Drupal\services\Entity\ServiceResource->hasServicePlugin()" => array:1 [▶]
  "25: Drupal\services\Entity\ServiceResource->createServicePluginInstance()" => array:1 [▶]
  "24: Drupal\services\Routing\ServiceEndpoint->routes()" => array:1 [▶]
  "23: call_user_func()" => array:1 [▶]
  "22: Drupal\Core\Routing\RouteBuilder->rebuild()" => array:1 [▶]
  "21: Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()" => array:1 [▶]
  "20: drupal_flush_all_caches()" => array:1 [▶]
  "19: Drupal\devel\Controller\DevelController->cacheClear()" => array:1 [▶]
  "18: call_user_func_array()" => array:1 [▶]
  "17: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
  "16: Drupal\Core\Render\Renderer->executeInRenderContext()" => array:2 [▶]
  "15: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()" => array:2 [▶]
  "14: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()" => array:1 [▶]
  "13: Symfony\Component\HttpKernel\HttpKernel->handleRaw()" => array:2 [▶]
  "12: Symfony\Component\HttpKernel\HttpKernel->handle()" => array:2 [▶]
  "11: Drupal\bat_api\StackMiddleware\BatApiMiddleware->handle()" => array:2 [▶]
  "10: Drupal\Core\StackMiddleware\Session->handle()" => array:2 [▶]
  " 9: Drupal\Core\StackMiddleware\KernelPreHandle->handle()" => array:2 [▶]
  " 8: Drupal\page_cache\StackMiddleware\PageCache->pass()" => array:2 [▶]
  " 7: Drupal\page_cache\StackMiddleware\PageCache->handle()" => array:2 [▶]
  " 6: Drupal\services\StackMiddleware\FormatSetter->handle()" => array:2 [▶]
  " 5: Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()" => array:2 [▶]
  " 4: Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle()" => array:2 [▶]
  " 3: Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()" => array:2 [▶]
  " 2: Stack\StackedHttpKernel->handle()" => array:2 [▶]
  " 1: Drupal\Core\DrupalKernel->handle()" => array:2 [▶]
  " 0: main()" => array:2 [▶]
]
🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇩🇪Germany fsnet

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024