The site fall with Errors, TypeError: strlen(): Argument #1

Created on 23 August 2023, over 1 year ago

Problem/Motivation

When I select Radios/Checkboxes options, in some filters suddenly the site stop working.

Steps to reproduce

I've add the varsbose code
" $config['system.logging']['error_level'] = 'verbose'; "

It show my this error message

The website encountered an unexpected error. Please try again later.
TypeError: strlen(): Argument #1 ($string) must be of type string, stdClass given in strlen() (line 477 of core/lib/Drupal/Component/Utility/Unicode.php).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

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

Comments & Activities

  • Issue created by @JohnTheWriter98
  • 🇮🇳India keshavv India

    @JohnTheWriter98 Can you please provide the complete error message?

  • Status changed to Postponed: needs info over 1 year ago
  • Thank you for reporting this issue.

    As suggested by @keshavv I would need more context about this error in order to reproduce and fix it.

    As-is I unfortunately cannot know what it causing the error.

    Looking forward to hearing from you @JohnTheWriter98

  • Yes sure, this is the full error message.

    The website encountered an unexpected error. Please try again later.
    TypeError: strlen(): Argument #1 ($string) must be of type string, stdClass given in strlen() (line 477 of core/lib/Drupal/Component/Utility/Unicode.php).
    strlen(Object) (Line: 477)
    Drupal\Component\Utility\Unicode::validateUtf8(Object) (Line: 65)
    Drupal\Component\Utility\Xss::filter(Object, Array) (Line: 751)
    Drupal\Core\Render\Renderer->ensureMarkupIsSafe(Array) (Line: 380)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 71)
    __TwigTemplate_bf314473f3a26d67b8d8d77fccf21d82->doDisplay(Array, Array) (Line: 405)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
    Twig\Template->display(Array) (Line: 390)
    Twig\Template->render(Array) (Line: 55)
    twig_render_template('themes/custom/socialfood_theme/templates/input/form-element-label.html.twig', Array) (Line: 384)
    Drupal\Core\Theme\ThemeManager->render('form_element_label', Array) (Line: 433)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 95)
    __TwigTemplate_8a8718cd1fea1c801ae0a0953a3f7876->doDisplay(Array, Array) (Line: 405)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
    Twig\Template->display(Array) (Line: 390)
    Twig\Template->render(Array) (Line: 55)
    twig_render_template('themes/contrib/bootstrap/templates/input/form-element.html.twig', Array) (Line: 384)
    Drupal\Core\Theme\ThemeManager->render('form_element', Array) (Line: 489)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 52)
    __TwigTemplate_a8231413fe402320bf0fe3c89adde0ef->doDisplay(Array, Array) (Line: 405)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
    Twig\Template->display(Array) (Line: 390)
    Twig\Template->render(Array) (Line: 55)
    twig_render_template('themes/contrib/bootstrap/templates/views/views-exposed-form.html.twig', Array) (Line: 384)
    Drupal\Core\Theme\ThemeManager->render('views_exposed_form', Array) (Line: 433)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 84)
    __TwigTemplate_6a86d9becee3ae4c3ad0b08c7f4af6dc->doDisplay(Array, Array) (Line: 405)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
    Twig\Template->display(Array) (Line: 390)
    Twig\Template->render(Array) (Line: 55)
    twig_render_template('themes/contrib/bootstrap/templates/views/views-view.html.twig', Array) (Line: 384)
    Drupal\Core\Theme\ThemeManager->render('views_view', Array) (Line: 433)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 446)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 242)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 243)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
    call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)
    Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)
    Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
    Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

  • Thank you for posting the full log. Unfortunately, it does not help to identify what is the wrong value. Somehow, something in your template form-element-label.html.twig is receiving and/or processing an object instead of a string.

    Can you try to disable this specific template temporarly?

    Can you test your View with a default theme (e.g. Olivero, Stark...) and confirm if the issue is still here?

  • 🇨🇦Canada dsim01

    Hi, I have the same issue, it happens when you select the option "Dropdown" and "Show hierarchy in dropdown". Then you choose "Radios/Checkboxes" and when you save, the error appears.

    Also, when you uncheck the hierarchy option, the checkboxes dosen't keep the hierarchical order of the taxonomy terms, so it is another issue.

    Thanks in advance for help.

Production build 0.71.5 2024