Fix warning when using roles in MariaDB
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
796b01cf09
commit
3c597dc229
@ -1806,7 +1806,7 @@ class DatabaseInterface implements DbalInterface
|
||||
|
||||
if (! $hasGrantPrivilege) {
|
||||
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
|
||||
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost ?? '', $collation);
|
||||
$query = QueryGenerator::getInformationSchemaDataForGranteeRequest($role, $roleHost, $collation);
|
||||
$result = $this->tryQuery($query);
|
||||
|
||||
if ($result) {
|
||||
@ -1865,7 +1865,7 @@ class DatabaseInterface implements DbalInterface
|
||||
|
||||
if (! $hasCreatePrivilege) {
|
||||
foreach ($this->getCurrentRolesAndHost() as [$role, $roleHost]) {
|
||||
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost ?? '', $collation);
|
||||
$query = QueryGenerator::getInformationSchemaDataForCreateRequest($role, $roleHost, $collation);
|
||||
$result = $this->tryQuery($query);
|
||||
|
||||
if ($result) {
|
||||
@ -1919,7 +1919,7 @@ class DatabaseInterface implements DbalInterface
|
||||
$roles = $this->getCurrentRoles();
|
||||
|
||||
$this->currentRoleAndHost = array_map(static function (string $role) {
|
||||
return explode('@', $role);
|
||||
return str_contains($role, '@') ? explode('@', $role) : [$role, ''];
|
||||
}, $roles);
|
||||
}
|
||||
|
||||
|
||||
@ -15225,11 +15225,6 @@ parameters:
|
||||
count: 2
|
||||
path: libraries/classes/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: "#^Variable \\$roleHost on left side of \\?\\? always exists and is not nullable\\.$#"
|
||||
count: 2
|
||||
path: libraries/classes/DatabaseInterface.php
|
||||
|
||||
-
|
||||
message: "#^Cannot call method escapeString\\(\\) on mixed\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -5684,10 +5684,8 @@
|
||||
</PossiblyNullArrayAccess>
|
||||
</file>
|
||||
<file src="libraries/classes/DatabaseInterface.php">
|
||||
<DocblockTypeContradiction occurrences="3">
|
||||
<DocblockTypeContradiction occurrences="1">
|
||||
<code>$this->extension === null</code>
|
||||
<code>''</code>
|
||||
<code>''</code>
|
||||
</DocblockTypeContradiction>
|
||||
<EmptyArrayAccess occurrences="1">
|
||||
<code>$result_target[]</code>
|
||||
@ -5908,10 +5906,6 @@
|
||||
<code>$databases[$database_name]['SCHEMA_TABLES']</code>
|
||||
<code>$databases[$database_name]['SCHEMA_TABLE_ROWS']</code>
|
||||
</PossiblyUndefinedArrayOffset>
|
||||
<RedundantConditionGivenDocblockType occurrences="2">
|
||||
<code>$roleHost</code>
|
||||
<code>$roleHost</code>
|
||||
</RedundantConditionGivenDocblockType>
|
||||
</file>
|
||||
<file src="libraries/classes/DbTableExists.php">
|
||||
<MixedArgument occurrences="2">
|
||||
|
||||
@ -163,7 +163,7 @@ class DatabaseInterfaceTest extends AbstractTestCase
|
||||
[['role', 'localhost'], ['role2', 'localhost']],
|
||||
],
|
||||
['8.0.0 - MySQL Community Server - GPL', true, [['@`localhost`']], ['@localhost'], [['', 'localhost']]],
|
||||
['10.5.0-MariaDB', true, [['`role`@`localhost`']], ['role@localhost'], [['role', 'localhost']]],
|
||||
['10.5.0-MariaDB', true, [['`role`']], ['role'], [['role', '']]],
|
||||
[
|
||||
'10.5.0-MariaDB',
|
||||
true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user