Error rendering breadcrumb list

Created on 15 July 2024, 6 months ago
Updated 30 July 2024, 5 months ago

Problem/Motivation

Since upgrading to 3.0.2, I get the following error and backtrace when the module tries to render a breadcrumb list through the schema_web_page submodule.

TypeError: Cannot access offset of type string on string in Drupal\Core\Render\Renderer->doRender() (line 318 of /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php).

#0 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#1 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render()
#2 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#3 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(166): Drupal\Core\Render\Renderer->executeInRenderContext()
#4 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(174): Drupal\Core\Render\Renderer->renderInIsolation()
#5 /var/www/drupal/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/BreadcrumbList.php(125): Drupal\Core\Render\Renderer->renderPlain()
#6 /var/www/drupal/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/ItemListElement.php(48): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->getItems()
#7 /var/www/drupal/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/BreadcrumbList.php(94): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\ItemListElement->outputValue()
#8 /var/www/drupal/web/modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaNameBase.php(206): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->outputValue()
#9 /var/www/drupal/web/modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaNameBase.php(179): Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->outputValue()
#10 /var/www/drupal/web/modules/contrib/metatag/src/MetatagManager.php(634): Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->output()
#11 /var/www/drupal/web/modules/contrib/metatag/src/MetatagManager.php(564): Drupal\metatag\MetatagManager->generateRawElements()
#12 /var/www/drupal/web/modules/contrib/metatag/metatag.module(504): Drupal\metatag\MetatagManager->generateElements()
#13 /var/www/drupal/web/modules/contrib/metatag/metatag.module(258): metatag_get_tags_from_route()
#14 /var/www/drupal/web/modules/contrib/metatag/metatag.module(218): _metatag_remove_duplicate_entity_tags()
#15 /var/www/drupal/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(552): metatag_entity_view_alter()
#16 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(305): Drupal\Core\Extension\ModuleHandler->alter()
#17 /var/www/drupal/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#18 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#19 /var/www/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
#20 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
#21 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
#22 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
#23 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render()
#24 /var/www/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#25 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext()
#26 /var/www/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
#27 /var/www/drupal/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
#28 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
#29 /var/www/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#30 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#31 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#32 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#33 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#34 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#35 /var/www/drupal/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#36 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#37 /var/www/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#38 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#39 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#40 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#41 /var/www/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#42 /var/www/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#43 /var/www/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#44 {main}

Steps to reproduce

1. Enable Schema.org: WebPage module
2. Configure WebPage metatag for a node type, using the "WebPage" type and enabling breadcrumbs.
3. View a node page of that type after clearing cache

I do have the easy_breadcrumb module installed, which might be related, but I do know things were working perfectly well with version 3.0.1 of this module.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States Maeglin

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

Merge Requests

Comments & Activities

  • Issue created by @Maeglin
  • 🇺🇸United States Maeglin
  • 🇺🇸United States corE
    • Drupal Version 10.3.1
    • PHP 8.3.9
    • Schema.org Metatag 3.0.2 (updated today)

    I'm getting an error message trying to edit content pages. I think it's related to this issue... my error wording is a little different...
    (I did make some metatag changes the other day so I'm not sure if it's related to that or the update today ??)

    The website encountered an unexpected error. Try again later.

    Error: Cannot use object of type Drupal\Core\StringTranslation\TranslatableMarkup as array in Drupal\Core\Render\Renderer->doRender() (line 269 of core/lib/Drupal/Core/Render/Renderer.php).

    Drupal\Core\Render\Renderer->render() (Line: 165)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 164)
    Drupal\Core\Render\Renderer->renderInIsolation() (Line: 174)
    Drupal\Core\Render\Renderer->renderPlain() (Line: 125)
    Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->getItems() (Line: 48)
    Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\ItemListElement->outputValue() (Line: 94)
    Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->outputValue() (Line: 206)
    Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->outputValue() (Line: 179)
    Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->output() (Line: 634)
    Drupal\metatag\MetatagManager->generateRawElements() (Line: 61)
    Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList::Drupal\metatag\Plugin\Field\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 48)
    Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->computeValue() (Line: 32)
    Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->ensureComputedValue() (Line: 114)
    Drupal\metatag\Plugin\Field\MetatagEntityFieldItemList->isEmpty() (Line: 162)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 164)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode() (Line: 106)
    Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate() (Line: 93)
    Drupal\Core\TypedData\Validation\RecursiveValidator->validate() (Line: 132)
    Drupal\Core\TypedData\TypedData->validate() (Line: 518)
    Drupal\Core\Entity\ContentEntityBase->validate() (Line: 188)
    Drupal\Core\Entity\ContentEntityForm->validateForm()
    call_user_func_array() (Line: 82)
    Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 274)
    Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
    Drupal\Core\Form\FormValidator->validateForm() (Line: 593)
    Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    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: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 57)
    Drupal\advban\AdvbanMiddleware->handle() (Line: 50)
    Drupal\ban\BanMiddleware->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)

  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Hi,

    Because all my nodes use the schema_metatag module, I have the same problem sitewide. On this D10.3.1 website, the PHP version is 8.3.9.

    TypeError: Cannot access offset of type string on string in Drupal\Core\Render\Renderer->doRender() (line 318 of /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php).

    #0 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #1 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(165): Drupal\Core\Render\Renderer->render()
    #2 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
    #3 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(164): Drupal\Core\Render\Renderer->executeInRenderContext()
    #4 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(174): Drupal\Core\Render\Renderer->renderInIsolation()
    #5 /home/gilloteaux/public_html/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/BreadcrumbList.php(125): Drupal\Core\Render\Renderer->renderPlain()
    #6 /home/gilloteaux/public_html/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/ItemListElement.php(48): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->getItems()
    #7 /home/gilloteaux/public_html/web/modules/contrib/schema_metatag/src/Plugin/schema_metatag/PropertyType/BreadcrumbList.php(94): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\ItemListElement->outputValue()
    #8 /home/gilloteaux/public_html/web/modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaNameBase.php(206): Drupal\schema_metatag\Plugin\schema_metatag\PropertyType\BreadcrumbList->outputValue()
    #9 /home/gilloteaux/public_html/web/modules/contrib/schema_metatag/src/Plugin/metatag/Tag/SchemaNameBase.php(179): Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->outputValue()
    #10 /home/gilloteaux/public_html/web/modules/contrib/metatag/src/MetatagManager.php(634): Drupal\schema_metatag\Plugin\metatag\Tag\SchemaNameBase->output()
    #11 /home/gilloteaux/public_html/web/modules/contrib/metatag/src/MetatagManager.php(564): Drupal\metatag\MetatagManager->generateRawElements()
    #12 /home/gilloteaux/public_html/web/modules/contrib/metatag/metatag.module(504): Drupal\metatag\MetatagManager->generateElements()
    #13 /home/gilloteaux/public_html/web/modules/contrib/metatag/metatag.module(131): metatag_get_tags_from_route()
    #14 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(311): metatag_page_attachments()
    #15 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #16 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(308): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    #17 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(285): Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks()
    #18 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #19 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(284): Drupal\Core\Render\Renderer->executeInRenderContext()
    #20 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
    #21 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
    #22 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    #23 /home/gilloteaux/public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
    #24 /home/gilloteaux/public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #25 /home/gilloteaux/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #26 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
    #27 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #28 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #29 /home/gilloteaux/public_html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #30 /home/gilloteaux/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #31 /home/gilloteaux/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch()
    #32 /home/gilloteaux/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup()
    #33 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #34 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #35 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #36 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #37 /home/gilloteaux/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #38 /home/gilloteaux/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
    #39 {main}

  • 🇫🇷France liliplanet Cannes

    Website crashed, unavailable, problem.

  • 🇺🇸United States DamienMcKenna NH, USA

    Bumping this to a critical issue as it's breaking sites.

  • Status changed to Needs review 6 months ago
  • 🇺🇸United States DamienMcKenna NH, USA

    Does this solve the problem?

  • 🇪🇸Spain luigisa Olloki Valley

    I generate a new patch to solve this issue.

  • 🇪🇸Spain luigisa Olloki Valley
  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Working on a live site, which patch do I have to apply?

  • 🇺🇸United States Maeglin

    The patch in #8 fixes it for me.

  • 🇧🇪Belgium gillesbailleux La Roche-en-Ardenne

    Patch #8 does not fix the problem
    gilloteaux@ct822-drupal:~/public_html/web/modules/contrib/schema_metatag$ wget https://www.drupal.org/files/issues/2024-07-16/schema_metatag-n3461565-8...
    --2024-07-16 16:29:17-- https://www.drupal.org/files/issues/2024-07-16/schema_metatag-n3461565-8...
    Resolving www.drupal.org (www.drupal.org)... 151.101.38.217
    Connecting to www.drupal.org (www.drupal.org)|151.101.38.217|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1445 (1.4K) [text/plain]
    Saving to: ‘schema_metatag-n3461565-8.patch’

    schema_metatag-n3461565-8.patch 100%[================================================================================================================>] 1.41K --.-KB/s in 0s

    2024-07-16 16:29:17 (34.5 MB/s) - ‘schema_metatag-n3461565-8.patch’ saved [1445/1445]

    gilloteaux@ct822-drupal:~/public_html/web/modules/contrib/schema_metatag$

  • 🇺🇸United States DamienMcKenna NH, USA

    The output shows the patch downloading but did you apply it?

    patch -p1 < schema_metatag-n3461565-8.patch

  • 🇺🇸United States DamienMcKenna NH, USA
  • Status changed to Fixed 6 months ago
  • 🇺🇸United States DamienMcKenna NH, USA

    Per a conversation on Slack, #8 fixes the problem for gillesbailleux too, so let's go with that.

  • 🇺🇸United States DamienMcKenna NH, USA
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024