Warning: Undefined array key "#type"

Created on 10 September 2024, 2 months ago
Updated 19 September 2024, 2 months ago

Problem/Motivation

When I visit any content checked by Wordfilter, I get two PHP warnings.
Any idea, please? Thanks

Tested version : Drupal 10.3.3 & Wordfilter 8.x-2.x

Warning: Undefined array key "#type" in wordfilter_entity_display_build_alter() (line 172 of /var/www/html/drupalx/web/modules/contrib/wordfilter/wordfilter.module)
Warning: Undefined array key "#type" in wordfilter_entity_display_build_alter() (line 181 of /var/www/html/d10site/web/modules/contrib/wordfilter/wordfilter.module)

More Details

#0 /var/www/html/d10site/web/core/includes/bootstrap.inc(166): _drupal_error_handler_real()
#1 /var/www/html/d10site/web/modules/contrib/wordfilter/wordfilter.module(172-181): _drupal_error_handler()
#2 /var/www/html/d10site/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(552): wordfilter_entity_display_build_alter()
#3 /var/www/html/d10site/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(289): Drupal\Core\Extension\ModuleHandler->alter()
#4 /var/www/html/d10site/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(340): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
#5 /var/www/html/d10site/web/core/modules/comment/src/CommentViewBuilder.php(119): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
#6 /var/www/html/d10site/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\comment\CommentViewBuilder->buildComponents()
#7 [internal function]: Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#8 /var/www/html/d10site/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#9 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#10 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#11 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
#12 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#13 /var/www/html/d10site/web/core/lib/Drupal/Core/Template/TwigExtension.php(475): Drupal\Core\Render\Renderer->render()
#14 /var/www/html/d10site/vendor/twig/twig/src/Environment.php(392) : eval()'d code(72): Drupal\Core\Template\TwigExtension->escapeFilter()
#15 /var/www/html/d10site/vendor/twig/twig/src/Template.php(360): __TwigTemplate_27e9e40532cf756f4aeca8c415dba71b->doDisplay()
#16 /var/www/html/d10site/vendor/twig/twig/src/Template.php(335): Twig\Template->yield()
#17 /var/www/html/d10site/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render()
#18 /var/www/html/d10site/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
#19 /var/www/html/d10site/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#20 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#21 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#22 /var/www/html/d10site/web/core/lib/Drupal/Core/Template/TwigExtension.php(475): Drupal\Core\Render\Renderer->render()
#23 /var/www/html/d10site/vendor/twig/twig/src/Environment.php(392) : eval()'d code(218): Drupal\Core\Template\TwigExtension->escapeFilter()
#24 /var/www/html/d10site/vendor/twig/twig/src/Template.php(360): __TwigTemplate_0a8d2f90771cfb9c3adff0cb4b553a85->doDisplay()
#25 /var/www/html/d10site/vendor/twig/twig/src/Template.php(335): Twig\Template->yield()
#26 /var/www/html/d10site/vendor/twig/twig/src/TemplateWrapper.php(38): Twig\Template->render()
#27 /var/www/html/d10site/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
#28 /var/www/html/d10site/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
#29 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
#30 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#31 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render()
#32 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#33 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext()
#34 /var/www/html/d10site/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#35 /var/www/html/d10site/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#36 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#37 /var/www/html/d10site/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#38 /var/www/html/d10site/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#39 /var/www/html/d10site/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#40 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#41 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#42 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#43 /var/www/html/d10site/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#44 /var/www/html/d10site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#45 /var/www/html/d10site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#46 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#47 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#48 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#49 /var/www/html/d10site/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#50 /var/www/html/d10site/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#51 /var/www/html/d10site/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#52 {main}

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @pearls
  • First commit to issue fork.
  • @bsuttis , Thanks for support.
    MR !6 tested. It didn't work. The same two errors persist.

  • 🇨🇦Canada bsuttis

    @pearls I had an issue that I thought was similar to yours and the MR fixes my issue.

    In my logs were:
    Warning: Undefined array key 0 in wordfilter_entity_display_build_alter() in line 182
    Warning: Trying to access array offset on value of type null in wordfilter_entity_display_build_alter() in line 182

    I guess yours is a separate issue. I was unable to reproduce yours on core 10.3.5/php 8.2.

  • @bsuttis, issues are same. Drupal core version is same. (Upgraded to 10.3.5.)
    The only difference is the php version I use is "8.3.6".
    I tested the patch on different projects but unfortunately the same warnings persist. The problem may be caused by the PHP version.
    My luck :)) Looks like I have nothing to do but wait until the module update arrives.Thanks for support.

Production build 0.71.5 2024