Update drupal site from Drupal8.6->8.9->9.5->10.2
Then got this error, no error on Drupal8.6

Drupal\Core\Database\DatabaseExceptionWrapper:Drupal\Core\Config\DatabaseStorage->readMultiple() 中的 SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '=': SELECT "name", "data" FROM "config" WHERE "collection" = :collection AND "name" IN ( :names__0 ); Array ( [:collection] => [:names__0] => user.role.举报 ) (/var/www/html/docroot/core/lib/Drupal/Core/Config/DatabaseStorage.php 的第 111 行)。

Backtrace:

#0 /var/www/html/docroot/core/lib/Drupal/Core/Database/Connection.php(858): Drupal\mysql\Driver\Database\mysql\ExceptionHandler->handleExecutionException(Object(PDOException), Object(Drupal\Core\Database\StatementWrapperIterator), Array, Array)
#1 /var/www/html/docroot/core/lib/Drupal/Core/Config/DatabaseStorage.php(111): Drupal\Core\Database\Connection->query('SELECT [name], ...', Array, Array)
#2 /var/www/html/docroot/core/lib/Drupal/Core/Config/CachedStorage.php(95): Drupal\Core\Config\DatabaseStorage->readMultiple(Array)
#3 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(165): Drupal\Core\Config\CachedStorage->readMultiple(Array)
#4 /var/www/html/docroot/core/lib/Drupal/Core/Config/ConfigFactory.php(136): Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array)
#5 /var/www/html/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(181): Drupal\Core\Config\ConfigFactory->loadMultiple(Array)
#6 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple(Array)
#7 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(262): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#8 /var/www/html/docroot/modules/contrib/webform/src/WebformEntityListBuilder.php(578): Drupal\Core\Entity\EntityStorageBase->load('\xE4\xB8\xBE\xE6\x8A\xA5')
#9 /var/www/html/docroot/modules/contrib/webform/src/WebformEntityListBuilder.php(542): Drupal\webform\WebformEntityListBuilder->getQuery('\xE4\xB8\xBE\xE6\x8A\xA5', '', '')
#10 /var/www/html/docroot/modules/contrib/webform/src/WebformEntityListBuilder.php(234): Drupal\webform\WebformEntityListBuilder->getTotal('\xE4\xB8\xBE\xE6\x8A\xA5', '', '')
#11 /var/www/html/docroot/modules/contrib/webform/src/WebformEntityListBuilder.php(168): Drupal\webform\WebformEntityListBuilder->buildInfo()
#12 /var/www/html/docroot/core/lib/Drupal/Core/Entity/Controller/EntityListController.php(23): Drupal\webform\WebformEntityListBuilder->render()
#13 [internal function]: Drupal\Core\Entity\Controller\EntityListController->listing('webform')
#14 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#15 /var/www/html/docroot/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#17 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#18 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#20 /var/www/html/docroot/modules/contrib/bat_api/src/StackMiddleware/BatApiMiddleware.php(39): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\bat_api\StackMiddleware\BatApiMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/www/html/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /var/www/html/docroot/modules/contrib/services/src/StackMiddleware/FormatSetter.php(45): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\services\StackMiddleware\FormatSetter->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#33 {main}

Issue fork webform-3415445

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lawxen created an issue. See original summary.

lawxen’s picture

Issue summary: View changes
lawxen’s picture

StatusFileSize
new486.26 KB

$role = $this->getEntityStorage('user_role')->load($keys) this Line caused the error,why webform load user role by the searched text?

lawxen’s picture

Reproduced Steps:
1. Fresh install Drupal10.2 and Webform 6.2.2
2. Go to /admin/structure/webform
3. Search Chinese like "文字"

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1267 Illegal mix of collations (ascii_general_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation '=': SELECT "name", "data" FROM "config" WHERE "collection" = :collection AND "name" IN ( :names__0 ); Array ( [:collection] => [:names__0] => user.role.测试 ) in Drupal\Core\Config\DatabaseStorage->readMultiple() (line 111 of /var/www/html/web/core/lib/Drupal/Core/Config/DatabaseStorage.php).
lawxen’s picture

\Drupal::entityTypeManager()->getStorage('user_role')->load("测试");
Just execute this line will got this error too.

lawxen’s picture

StatusFileSize
new1.27 KB

Add a quick workaround patch, not fix solution

cilefen’s picture

So is this a duplicate of a Core bug?

lawxen’s picture

So is this a duplicate of a Core bug?

Yes, it is.

cilefen’s picture

Status: Active » Closed (duplicate)

konstara made their first commit to this issue’s fork.

konstara’s picture

StatusFileSize
new628 bytes

For meantime as the core gets updated with solution that eventually closes this, here is a small workaround patch for this particular problem.

weseze’s picture

I'm also struggling to understand why we are searching for users and roles with the given search string?
What is the use case for this?

cilefen’s picture

Status: Closed (duplicate) » Active

This can’t be fixed in core.

jrockowitz’s picture

Status: Active » Needs review

The use case is to allow the keyword search for webforms to search for matching users and roles.
https://git.drupalcode.org/project/webform/-/blob/6.3.x/src/WebformEntit...

I'd like to keep this feature and I am okay with removing any invalid character when searching roles.

The patch from #12 seems to be going in the right direction. Can someone please confirm that this is the best approach to filtering out non-english characters.

cilefen’s picture

I am pushing for #3475540: Use a route requirement to prevent non-ASCII characters causing an exception when looking up a config entity in Core, so yes, the right thing to do is to filter the input.

jrockowitz’s picture

Version: 6.2.x-dev » 6.3.x-dev

Let's go with the patch from #12.

  • jrockowitz committed 1f4be598 on 6.3.x
    Issue #3415445: Search Chinese in /admin/structure/webform cause error:...
jrockowitz’s picture

Status: Needs review » Fixed
jrockowitz’s picture

  • liam morland committed c2e28db9 on 6.3.x
    Issue #3415445: Add spelling exception
    
    Fixes issue introduced in...

  • liam morland committed c2e28db9 on 6.x
    Issue #3415445: Add spelling exception
    
    Fixes issue introduced in...

  • jrockowitz committed 1f4be598 on 6.x
    Issue #3415445: Search Chinese in /admin/structure/webform cause error:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.