Replace escapeString with quoteString in AccountLocking class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
5cf1ec8bc3
commit
2722ea717d
@ -27,9 +27,9 @@ final class AccountLocking
|
||||
}
|
||||
|
||||
$statement = sprintf(
|
||||
'ALTER USER \'%s\'@\'%s\' ACCOUNT LOCK;',
|
||||
$this->dbi->escapeString($user),
|
||||
$this->dbi->escapeString($host)
|
||||
'ALTER USER %s@%s ACCOUNT LOCK;',
|
||||
$this->dbi->quoteString($user),
|
||||
$this->dbi->quoteString($host)
|
||||
);
|
||||
if ($this->dbi->tryQuery($statement) !== false) {
|
||||
return;
|
||||
@ -48,9 +48,9 @@ final class AccountLocking
|
||||
}
|
||||
|
||||
$statement = sprintf(
|
||||
'ALTER USER \'%s\'@\'%s\' ACCOUNT UNLOCK;',
|
||||
$this->dbi->escapeString($user),
|
||||
$this->dbi->escapeString($host)
|
||||
'ALTER USER %s@%s ACCOUNT UNLOCK;',
|
||||
$this->dbi->quoteString($user),
|
||||
$this->dbi->quoteString($host)
|
||||
);
|
||||
if ($this->dbi->tryQuery($statement) !== false) {
|
||||
return;
|
||||
|
||||
@ -14177,14 +14177,6 @@
|
||||
<code><![CDATA[$_POST['max_user_connections']]]></code>
|
||||
</RiskyCast>
|
||||
</file>
|
||||
<file src="libraries/classes/Server/Privileges/AccountLocking.php">
|
||||
<DeprecatedMethod>
|
||||
<code>escapeString</code>
|
||||
<code>escapeString</code>
|
||||
<code>escapeString</code>
|
||||
<code>escapeString</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="libraries/classes/Server/Select.php">
|
||||
<MixedArgumentTypeCoercion>
|
||||
<code><![CDATA[$server['only_db']]]></code>
|
||||
@ -18096,14 +18088,6 @@
|
||||
<code>assertIsArray</code>
|
||||
</RedundantCondition>
|
||||
</file>
|
||||
<file src="test/classes/Server/Privileges/AccountLockingTest.php">
|
||||
<DeprecatedMethod>
|
||||
<code>withConsecutive</code>
|
||||
<code>withConsecutive</code>
|
||||
<code>withConsecutive</code>
|
||||
<code>withConsecutive</code>
|
||||
</DeprecatedMethod>
|
||||
</file>
|
||||
<file src="test/classes/Server/PrivilegesTest.php">
|
||||
<DeprecatedMethod>
|
||||
<code>escapeString</code>
|
||||
|
||||
@ -20,10 +20,8 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(100402);
|
||||
$dbi->expects($this->exactly(2))
|
||||
->method('escapeString')
|
||||
->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
|
||||
->willReturnOnConsecutiveCalls('test.user', 'test.host');
|
||||
$dbi->expects($this->exactly(2))->method('quoteString')
|
||||
->will($this->returnCallback(static fn (string $string) => "'" . $string . "'"));
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($this->equalTo('ALTER USER \'test.user\'@\'test.host\' ACCOUNT LOCK;'))
|
||||
@ -39,10 +37,8 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(100402);
|
||||
$dbi->expects($this->exactly(2))
|
||||
->method('escapeString')
|
||||
->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
|
||||
->willReturnOnConsecutiveCalls('test.user', 'test.host');
|
||||
$dbi->expects($this->exactly(2))->method('quoteString')
|
||||
->will($this->returnCallback(static fn (string $string) => "'" . $string . "'"));
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($this->equalTo('ALTER USER \'test.user\'@\'test.host\' ACCOUNT LOCK;'))
|
||||
@ -62,7 +58,7 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(100401);
|
||||
$dbi->expects($this->never())->method('escapeString');
|
||||
$dbi->expects($this->never())->method('quoteString');
|
||||
$dbi->expects($this->never())->method('tryQuery');
|
||||
$dbi->expects($this->never())->method('getError');
|
||||
|
||||
@ -79,10 +75,8 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(100402);
|
||||
$dbi->expects($this->exactly(2))
|
||||
->method('escapeString')
|
||||
->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
|
||||
->willReturnOnConsecutiveCalls('test.user', 'test.host');
|
||||
$dbi->expects($this->exactly(2))->method('quoteString')
|
||||
->will($this->returnCallback(static fn (string $string) => "'" . $string . "'"));
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($this->equalTo('ALTER USER \'test.user\'@\'test.host\' ACCOUNT UNLOCK;'))
|
||||
@ -98,10 +92,8 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(true);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(100402);
|
||||
$dbi->expects($this->exactly(2))
|
||||
->method('escapeString')
|
||||
->withConsecutive([$this->equalTo('test.user')], [$this->equalTo('test.host')])
|
||||
->willReturnOnConsecutiveCalls('test.user', 'test.host');
|
||||
$dbi->expects($this->exactly(2))->method('quoteString')
|
||||
->will($this->returnCallback(static fn (string $string) => "'" . $string . "'"));
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($this->equalTo('ALTER USER \'test.user\'@\'test.host\' ACCOUNT UNLOCK;'))
|
||||
@ -121,7 +113,7 @@ class AccountLockingTest extends TestCase
|
||||
$dbi = $this->createMock(DatabaseInterface::class);
|
||||
$dbi->expects($this->once())->method('isMariaDB')->willReturn(false);
|
||||
$dbi->expects($this->once())->method('getVersion')->willReturn(50705);
|
||||
$dbi->expects($this->never())->method('escapeString');
|
||||
$dbi->expects($this->never())->method('quoteString');
|
||||
$dbi->expects($this->never())->method('tryQuery');
|
||||
$dbi->expects($this->never())->method('getError');
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user