Problem/Motivation

While testing #3483392: Build privacy base recipe I ran into a warning about an undefined array key right after the creation of a node that contained a remote media type (wanted to test the content blocking functionality for remote content in the aforementioned recipe):

Warning: Undefined array key "type" in Drupal\klaro\Utility\KlaroHelper->rewriteAttributes() (line 523 of modules/contrib/klaro/src/Utility/KlaroHelper.php).
Drupal\klaro\Utility\KlaroHelper->rewriteAttributes() (Line: 190)
klaro_preprocess_field()
call_user_func_array() (Line: 261)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 61)
__TwigTemplate_abd131a4795446e2d9e285c064f6e784->doDisplay() (Line: 393)
Twig\Template->yield() (Line: 349)
Twig\Template->display() (Line: 364)
Twig\Template->render() (Line: 35)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 130)
__TwigTemplate_77634abae9a6ed835a906476f6c09e39->doDisplay() (Line: 393)
Twig\Template->yield() (Line: 349)
Twig\Template->display() (Line: 364)
Twig\Template->render() (Line: 35)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 141)
__TwigTemplate_e90f16a02ae6e9be47f3dc994292f743->doDisplay() (Line: 393)
Twig\Template->yield() (Line: 349)
Twig\Template->display() (Line: 364)
Twig\Template->render() (Line: 35)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
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: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
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: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

The warning shows consistently each time a new node is being created on the node page in the frontend (olivero in this case), after a reload the warning is gone. The warning is shown for nodes with vimeo as well as youtube links.

*Tested on DDEV with PHP8.3 with drupal 10.4.0-dev

Steps to reproduce

  • create a content type with a media field with the remote video media type
  • create a node and save it.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

rkoller created an issue. See original summary.

rkoller’s picture

Version: 3.0.0-rc7 » 3.x-dev

woops just realized the recipe is using dev-3.x 5605905

jan kellermann’s picture

Status: Active » Fixed

Thank you very much for work and reporting!
The bugfix is already part of MR13 and will be fixed after merge, see https://git.drupalcode.org/project/klaro/-/merge_requests/13/diffs#c30f9...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.