From e5cc12235c6136413ac3122fb4e278cd32f605a3 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Tue, 9 Jan 2024 03:35:09 +0100 Subject: [PATCH] Remove escapeString completely Signed-off-by: Kamil Tekiela --- psalm-baseline.xml | 3 --- src/DatabaseInterface.php | 19 ------------------- src/Dbal/DbalInterface.php | 12 ------------ tests/classes/Dbal/DbiDummyTest.php | 15 --------------- 4 files changed, 49 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 120c7ae38d..659be97e14 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -5125,7 +5125,6 @@ connections[$connectionType]]]> connections[$connectionType]]]> connections[$connectionType]]]> - connections[$connectionType]]]> versionComment]]> versionString]]> @@ -13830,8 +13829,6 @@ Config::getInstance() - escapeString - escapeString errorData diff --git a/src/DatabaseInterface.php b/src/DatabaseInterface.php index 4ddee37c72..46fc5a1567 100644 --- a/src/DatabaseInterface.php +++ b/src/DatabaseInterface.php @@ -1878,25 +1878,6 @@ class DatabaseInterface implements DbalInterface return "'" . $this->extension->escapeString($this->connections[$connectionType], $str) . "'"; } - /** - * returns properly escaped string for use in MySQL queries - * - * @deprecated Use {@see quoteString()} instead. - * - * @param string $str string to be escaped - * @psalm-param ConnectionType $connectionType - * - * @return string a MySQL escaped string - */ - public function escapeString(string $str, int $connectionType = Connection::TYPE_USER): string - { - if (isset($this->connections[$connectionType])) { - return $this->extension->escapeString($this->connections[$connectionType], $str); - } - - return $str; - } - /** * Returns properly escaped string for use in MySQL LIKE clauses. * This method escapes only _, %, and /. It does not escape quotes or any other characters. diff --git a/src/Dbal/DbalInterface.php b/src/Dbal/DbalInterface.php index 40a49986e4..c23a48c63b 100644 --- a/src/Dbal/DbalInterface.php +++ b/src/Dbal/DbalInterface.php @@ -563,18 +563,6 @@ interface DbalInterface */ public function quoteString(string $str, int $connectionType = Connection::TYPE_USER): string; - /** - * returns properly escaped string for use in MySQL queries - * - * @deprecated Use {@see quoteString()} instead. - * - * @param string $str string to be escaped - * @psalm-param ConnectionType $connectionType - * - * @return string a MySQL escaped string - */ - public function escapeString(string $str, int $connectionType = Connection::TYPE_USER): string; - /** * Returns properly escaped string for use in MySQL LIKE clauses. * This method escapes only _, %, and /. It does not escape quotes or any other characters. diff --git a/tests/classes/Dbal/DbiDummyTest.php b/tests/classes/Dbal/DbiDummyTest.php index 2aa9d5d732..0cc488df90 100644 --- a/tests/classes/Dbal/DbiDummyTest.php +++ b/tests/classes/Dbal/DbiDummyTest.php @@ -112,19 +112,4 @@ class DbiDummyTest extends AbstractTestCase ], ]; } - - /** - * Test for string escaping - */ - public function testEscapeString(): void - { - $this->assertEquals( - 'a', - $this->dbi->escapeString('a'), - ); - $this->assertEquals( - 'a\\\'', - $this->dbi->escapeString('a\''), - ); - } }