Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
FYI. After upgrading the core from 8.0.3 to 8.0.4 I am seeing the following error when I load my (one and only) forum page (/forum/13). This error does not present itself on any of the Article, Basic, Form or View pages on this website.
Uninstalling Token 8.x-1.0-alpha2 appears to have resolved this issue for me.
Notice: Array to string conversion in Drupal\Component\Render\HtmlEscapedText->__construct() (line 37 of core/lib/Drupal/Component/Render/HtmlEscapedText.php).
Drupal\Component\Render\HtmlEscapedText->__construct(Array)
Drupal\Core\Utility\Token->replace('[current-page:title] | [site:name]', Array, Array)
Drupal\metatag\MetatagToken->coreReplace('[current-page:title] | [site:name]', Array, Array)
Drupal\metatag\MetatagToken->contribReplace('[current-page:title] | [site:name]', Array, Array)
Drupal\metatag\MetatagToken->tokenReplace('[current-page:title] | [site:name]', Array)
Drupal\metatag\MetatagManager->generateElements(Array, NULL)
metatag_get_tags_from_route()
metatag_page_attachments(Array)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)
Comment | File | Size | Author |
---|---|---|---|
#9 | notice_token_replacement-2675738-#8.patch | 823 bytes | Ashutosh.tripathi |
Comments
Comment #2
sachbearbeiter CreditAttribution: sachbearbeiter commentedSame error with 8.0.3 ...
Comment #3
MartinMa CreditAttribution: MartinMa commented... and same with 8.0.5 :-(
Comment #4
platinum1 CreditAttribution: platinum1 commentedWe have the same issue or a variation thereof:
Notice: Array to string conversion in Drupal\Component\Render\HtmlEscapedText->__construct() (line 37 of core/lib/Drupal/Component/Render/HtmlEscapedText.php).
Drupal\Component\Render\HtmlEscapedText->__construct(Array) (Line: 209)
Drupal\Core\Utility\Token->replace('[current-page:title] | [site:name]', Array, Array) (Line: 45)
Drupal\metatag\MetatagToken->replace('[current-page:title] | [site:name]', Array, Array) (Line: 305)
Drupal\metatag\MetatagManager->generateElements(Array, NULL) (Line: 217)
metatag_get_tags_from_route() (Line: 67)
metatag_page_attachments(Array) (Line: 302)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 278)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 122)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 95)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 116)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 55)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 631)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
The error appears when an Anonymous User or an Authenticated User accesses forum posts. The error does not appear when the Admin accesses the same forum posts.
The Drupal version is 8.1.x-dev
Comment #5
platinum1 CreditAttribution: platinum1 commentedComment #6
platinum1 CreditAttribution: platinum1 commentedUpdated the title, as the problem is not restricted to a D8.0.4 upgrade
Comment #7
fomenkoandrey CreditAttribution: fomenkoandrey commenteddrupal 8.0.5
i have this error, after updating the Token module to the last version.
Comment #8
Ashutosh.tripathi CreditAttribution: Ashutosh.tripathi commentedFIxed this issue by adding below code snippet :
at line 204 in core/lib/Drupal/Core/Utility/Token.php
Comment #9
Ashutosh.tripathi CreditAttribution: Ashutosh.tripathi commentedComment #10
platinum1 CreditAttribution: platinum1 commentedWorks for me on D8.2.x-dev :-)
Thank you @Ashutosh.tripathi
Comment #11
platinum1 CreditAttribution: platinum1 commentedComment #14
BerdirWhat you posted is a core patch, not token module.
However, that is just a workaround. Some token returns a render array instead of a string, that is not valid.
I'm guessing that forum returns a render array, which might work when printed in twig but not in a token. We need to do that conversion where the current-page:title token is generated.
Comment #15
huzookaThe bug appears on user pages too if the
current-page:title
token is used. So, this seems to be a more generic token (i mean current-page:title) related error.Comment #16
webflo CreditAttribution: webflo at UEBERBIT GmbH commentedPosted a patch in #2714257: [current-page:title] not working properly on pages with a render array as title
Comment #17
BerdirThanks.