Created on 24 March 2025, 18 days ago

Problem/Motivation

Since 📌 Automated Drupal 11 compatibility fixes for copyscape Needs review , browsing to /admin/config/copyscape/api triggers this error:

strlen(): Argument #1 ($string) must be of type string, Drupal\user\Entity\Role given

Steps to reproduce

Browse to /admin/config/copyscape/api

Proposed resolution

user_role_names() was replaced by Role::loadMultiple() but this method does not return an array of strings.
There is a suggested solution with array_map() here: https://www.drupal.org/node/3349759

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇫🇷France prudloff Lille

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

Merge Requests

Comments & Activities

  • Issue created by @prudloff
  • 🇨🇦Canada danrod Ottawa

    Thanks for reporting this @prudloff , did you try the DEV release and got this error? I'll check now.

  • 🇨🇦Canada danrod Ottawa

    Yes, I can see the error now:

    The website encountered an unexpected error. Try again later.
    
    TypeError: strlen(): Argument #1 ($string) must be of type string, Drupal\user\Entity\Role given in strlen() (line 395 of core/lib/Drupal/Component/Utility/Unicode.php).
    Drupal\Component\Utility\Unicode::validateUtf8() (Line: 65)
    Drupal\Component\Utility\Xss::filter() (Line: 796)
    Drupal\Core\Render\Renderer->ensureMarkupIsSafe() (Line: 393)
    Drupal\Core\Render\Renderer->doRender() (Line: 203)
    Drupal\Core\Render\Renderer->render() (Line: 484)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 55)
    __TwigTemplate_217f8ca5fe867fa7ab448440c131316e->doDisplay() (Line: 388)
    Twig\Template->yield() (Line: 344)
    Twig\Template->display() (Line: 359)
    Twig\Template->render() (Line: 51)
    Twig\TemplateWrapper->render() (Line: 33)
    twig_render_template() (Line: 348)

    I'll apply the suggested fix and let's see how it goes

  • 🇨🇦Canada danrod Ottawa

    I merged the suggested fix (and also merged the issue # 3514887) but It seems like the copyscape validator is being bypassed in Drupal 11, in Drupal 10 works fine, so I'll change this to "Needs Work" until we are sure the module is working for D11.

    I merged the issue # 3514887 to the main branch and no issues so far.

    Thanks again @prudloff for reporting this.

  • 🇨🇦Canada danrod Ottawa
  • 🇨🇦Canada danrod Ottawa

    I've done a few tests in D11 and works better so far:

    I'll move it to "Needs Review" for now.

  • 🇨🇦Canada danrod Ottawa
  • 🇨🇦Canada danrod Ottawa

    Looks so much better now

    I'll move it to "Fixed" for now, if anyone is still haveing any problems, please let let me know and I'll re-open the task.

    Thanks a lot to @prudloff for creating this issue.

  • 🇨🇦Canada danrod Ottawa
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024