- Issue created by @asherry
- Status changed to Needs review
almost 2 years ago 8:33pm 26 October 2023 - last update
almost 2 years ago 3 pass - last update
almost 2 years ago 3 pass - 🇫🇷France asherry
Ran into another error if the $arg variable turns out to be a proper EntityInterface object. I put in another check to see if it's a proper entity, just add it to the array, but, also check if it's an int/str to make sure it's safe to pass to entity load.
Still not sure about this solution as a whole, but, it's fixing errors for us at the moment.
- 🇫🇮Finland heikkiy Oulu
I found this issue when installing Notification message to our side crashed a view with contextual filters in the URL.
The error in our case was this
The website encountered an unexpected error. Try again later. Drupal\Component\Plugin\Exception\PluginNotFoundException: The "arg_0" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of core/lib/Drupal/Core/Entity/EntityTypeManager.php). Drupal\Core\Entity\EntityTypeManager->getHandler() (Line: 192) Drupal\Core\Entity\EntityTypeManager->getStorage() (Line: 129) Drupal\notification_message\Cache\Context\RouteEntityUuidCacheContext->attachViewRouteEntities() (Line: 86) Drupal\notification_message\Cache\Context\RouteEntityUuidCacheContext->entityCacheTagsFromRoute() (Line: 60) Drupal\notification_message\Cache\Context\RouteEntityUuidCacheContext->getContext() (Line: 123) Drupal\Core\Cache\Context\CacheContextsManager->convertTokensToKeys() (Line: 244) Drupal\Core\Cache\VariationCache->createCacheIdFast() (Line: 175) Drupal\Core\Cache\VariationCache->getRedirectChain() (Line: 35) Drupal\Core\Cache\VariationCache->get() (Line: 71) Drupal\Core\Render\RenderCache->get() (Line: 113) Drupal\Core\Render\PlaceholderingRenderCache->get() (Line: 317) Drupal\Core\Render\Renderer->doRender() (Line: 493) Drupal\Core\Render\Renderer->doRender() (Line: 240) Drupal\Core\Render\Renderer->render() (Line: 475) Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 122) __TwigTemplate_a80a95a6a8c5a3904dde60ae71cea77e->block_page_pre_content() (Line: 171) Twig\Template->displayBlock() (Line: 130) __TwigTemplate_f0b5e2f7c622ad70fb53191694409337->doDisplay() (Line: 394) Twig\Template->displayWithErrorHandling() (Line: 367) Twig\Template->display() (Line: 61) __TwigTemplate_a80a95a6a8c5a3904dde60ae71cea77e->doDisplay() (Line: 394) Twig\Template->displayWithErrorHandling() (Line: 367) Twig\Template->display() (Line: 39) __TwigTemplate_9e59da2f5f2329765a9dfd034cd52843->doDisplay() (Line: 394) Twig\Template->displayWithErrorHandling() (Line: 367) Twig\Template->display() (Line: 379) Twig\Template->render() (Line: 38) Twig\TemplateWrapper->render() (Line: 39) twig_render_template() (Line: 348) Drupal\Core\Theme\ThemeManager->render() (Line: 480) Drupal\Core\Render\Renderer->doRender() (Line: 240) Drupal\Core\Render\Renderer->render() (Line: 475) Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 81) __TwigTemplate_cba7f8237d6b6745d5fea617efe7d916->doDisplay() (Line: 394) Twig\Template->displayWithErrorHandling() (Line: 367) Twig\Template->display() (Line: 39) __TwigTemplate_f020d8f0b6dad9d1f81515d1f59f880c->doDisplay() (Line: 394) Twig\Template->displayWithErrorHandling() (Line: 367) Twig\Template->display() (Line: 379) Twig\Template->render() (Line: 38) Twig\TemplateWrapper->render() (Line: 39) twig_render_template() (Line: 348) Drupal\Core\Theme\ThemeManager->render() (Line: 480) Drupal\Core\Render\Renderer->doRender() (Line: 240) Drupal\Core\Render\Renderer->render() (Line: 158) Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 153) Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90) Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() call_user_func() (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704) Drupal\Core\DrupalKernel->handle() (Line: 19)
The patch in this issue fixed the problem. I would be willing to mark this RTBC and mark it Major or even Critical because it causes a crash. I will see if I can come up with another suggestion how to fix this.
- last update
over 1 year ago 3 pass - 🇫🇮Finland heikkiy Oulu
I tried to improve the code a bit and made some small improvements. Here is an attached patch with following changes.
1. Added a check for $route_object being null to avoid potential errors.
2. Used instanceof instead of is_a for checking if $arg is an instance of EntityInterface.
3. Some small style changes.Tested that the issue is still resolved.
- Merge request !22Issue 3397028: Improve attachViewRouteEntities() to prevent errors in view... → (Open) created by heikkiy
- last update
over 1 year ago 3 pass - 🇫🇮Finland heikkiy Oulu
I opened a MR for this for easier review and commenting.
- Status changed to RTBC
12 days ago 4:24pm 8 September 2025 - 🇺🇸United States grgcrlsn321
I'm marking this RTCB. It should be merged in because it breaks views easily using contextual filters. The patch solves the issue for handling the argument and adds validation for only passing entity types.