From 0733716c7564f5e5281932c5c967fd1438bdc2a0 Mon Sep 17 00:00:00 2001
From: mondrake <28163-mondrake@users.noreply.drupalcode.org>
Date: Sat, 1 Jul 2023 22:48:05 +0000
Subject: [PATCH] Issue #3371751 by mondrake: Fix HelpSearch queries to ensure
 db identifiers are properly escaped

---
 core/modules/help/src/Plugin/Search/HelpSearch.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/modules/help/src/Plugin/Search/HelpSearch.php b/core/modules/help/src/Plugin/Search/HelpSearch.php
index 896c0a660855..e59d67549d9a 100644
--- a/core/modules/help/src/Plugin/Search/HelpSearch.php
+++ b/core/modules/help/src/Plugin/Search/HelpSearch.php
@@ -443,8 +443,8 @@ public function updateTopicList() {
    */
   public function updateIndexState() {
     $query = $this->database->select('help_search_items', 'hsi');
-    $query->addExpression('COUNT(DISTINCT(hsi.sid))');
-    $query->leftJoin('search_dataset', 'sd', 'hsi.sid = sd.sid AND sd.type = :type', [':type' => $this->getType()]);
+    $query->addExpression('COUNT(DISTINCT([hsi].[sid]))');
+    $query->leftJoin('search_dataset', 'sd', '[hsi].[sid] = [sd].[sid] AND [sd].[type] = :type', [':type' => $this->getType()]);
     $query->isNull('sd.sid');
     $never_indexed = $query->execute()->fetchField();
     $this->state->set('help_search_unindexed_count', $never_indexed);
-- 
GitLab