Skip to content

Commit 31800be

Browse files
kamil-tekielaMauricioFauth
authored andcommitted
Use quoteString in Util
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent a659874 commit 31800be

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

libraries/classes/Util.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,7 @@ private static function getConditionValue(
825825
$conditionValue = "= b'"
826826
. self::printableBitValue((int) $row, $meta->length) . "'";
827827
} else {
828-
$conditionValue = '= \''
829-
. $GLOBALS['dbi']->escapeString((string) $row) . '\'';
828+
$conditionValue = '= ' . $GLOBALS['dbi']->quoteString((string) $row);
830829
}
831830

832831
return [$conditionValue, $condition];
@@ -1711,14 +1710,14 @@ public static function currentUserHasPrivilege(string $priv, string|null $db = n
17111710
return false;
17121711
}
17131712

1714-
$query .= " AND '%s' LIKE `TABLE_SCHEMA`";
1713+
$query .= ' AND %s LIKE `TABLE_SCHEMA`';
17151714
$schemaPrivileges = $GLOBALS['dbi']->fetchValue(
17161715
sprintf(
17171716
$query,
17181717
'SCHEMA_PRIVILEGES',
17191718
$username,
17201719
$priv,
1721-
$GLOBALS['dbi']->escapeString($db),
1720+
$GLOBALS['dbi']->quoteString($db),
17221721
),
17231722
);
17241723
if ($schemaPrivileges) {
@@ -1728,15 +1727,15 @@ public static function currentUserHasPrivilege(string $priv, string|null $db = n
17281727
// If a table name was also provided and we still didn't
17291728
// find any valid privileges, try table-wise privileges.
17301729
if ($tbl !== null) {
1731-
$query .= " AND TABLE_NAME='%s'";
1730+
$query .= ' AND TABLE_NAME=%s';
17321731
$tablePrivileges = $GLOBALS['dbi']->fetchValue(
17331732
sprintf(
17341733
$query,
17351734
'TABLE_PRIVILEGES',
17361735
$username,
17371736
$priv,
1738-
$GLOBALS['dbi']->escapeString($db),
1739-
$GLOBALS['dbi']->escapeString($tbl),
1737+
$GLOBALS['dbi']->quoteString($db),
1738+
$GLOBALS['dbi']->quoteString($tbl),
17401739
),
17411740
);
17421741
if ($tablePrivileges) {

psalm-baseline.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14707,12 +14707,6 @@
1470714707
<ArgumentTypeCoercion>
1470814708
<code>$separator</code>
1470914709
</ArgumentTypeCoercion>
14710-
<DeprecatedMethod>
14711-
<code>escapeString</code>
14712-
<code>escapeString</code>
14713-
<code>escapeString</code>
14714-
<code>escapeString</code>
14715-
</DeprecatedMethod>
1471614710
<InvalidArrayOffset>
1471714711
<code><![CDATA[$GLOBALS['cfg']['SkipLockedTables']]]></code>
1471814712
<code>$byteUnits[$d]</code>

0 commit comments

Comments
 (0)