diff --git a/typo3/sysext/core/Classes/Database/Connection.php b/typo3/sysext/core/Classes/Database/Connection.php
index 3474b7be4af4cd0c01616a47808b010571b220ee..72e391dfd836a3e9185745f5be3bec9d4ab12a0d 100644
--- a/typo3/sysext/core/Classes/Database/Connection.php
+++ b/typo3/sysext/core/Classes/Database/Connection.php
@@ -183,6 +183,18 @@ class Connection extends \Doctrine\DBAL\Connection implements LoggerAwareInterfa
         return $this->quoteColumnValuePairs($input);
     }
 
+    /**
+     * Quotes like wildcards for given string value.
+     *
+     * @param string $value The value to be quoted.
+     *
+     * @return string The quoted value.
+     */
+    public function escapeLikeWildcards(string $value): string
+    {
+        return addcslashes($value, '_%');
+    }
+
     /**
      * Inserts a table row with specified data.
      *
diff --git a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
index 099819e5bfc9c4c4c9e3d48bd851da476776e342..9594fb60bddb8aab1830f0b2968b1999c2c3aa02 100644
--- a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
+++ b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
@@ -1100,7 +1100,7 @@ class QueryBuilder
      */
     public function escapeLikeWildcards(string $value): string
     {
-        return addcslashes($value, '_%');
+        return $this->connection->escapeLikeWildcards($value);
     }
 
     /**