Error on autocompletion request for user

Created on 27 April 2023, almost 2 years ago

Problem/Motivation

In the field "Authored by" on node edition, in autocomplรฉtion mode, when I write something, the autocompletion request ends with error.

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens: 

SELECT "base_table"."uid" AS "uid", "base_table"."uid" AS "base_table_uid" FROM "users" "base_table" INNER JOIN 
"users_field_data" "users_field_data" ON "users_field_data"."uid" = "base_table"."uid" WHERE ("users_field_data"."name" LIKE :db_condition_placeholder_1 ESCAPE '\\') 
OR (((anonymous_name LIKE :db_condition_placeholder_0 ESCAPE '\\')) AND ("base_table"."uid" = :db_condition_placeholder_2)) GROUP BY "base_table"."uid" LIMIT 10 OFFSET 0; 

Array  [:db_condition_placeholder_1] => %nherve@ina.fr (139555)% 
[:db_condition_placeholder_0] => %nherve@ina.fr (139555)%     
[:anonymous_name] => Anonyme    
 [:db_condition_placeholder_2] => 0 )  

in Drupal\Core\Entity\Query\Sql\Query->result() (line 272 of /opt/drupal/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

Steps to reproduce

Activate the "authored by" field with autocompletion

Proposed resolution

in core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php (line 248), if I remove the

$query->escapeField('anonymous_name')

in the str_replace, I don't have the error anymore.

๐Ÿ› Bug report
Status

Active

Version

9.5

Component
User systemย  โ†’

Last updated 9 days ago

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance mounir_abid

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

Comments & Activities

Production build 0.71.5 2024