Skip to content

Commit 566a51a

Browse files
Incorrect argument type fix (#18458)
* Incorrect argument type to variable Signed-off-by: SachinBahukhandi <sachinb0013@gmail.com> * Linted code Signed-off-by: SachinBahukhandi <sachinb0013@gmail.com> --------- Signed-off-by: SachinBahukhandi <sachinb0013@gmail.com>
1 parent aad3b57 commit 566a51a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

libraries/classes/Controllers/Server/Variables/SetVariableController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function __invoke(ServerRequest $request, array $vars): void
5252
) {
5353
$exp = ['kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3];
5454
$value = (float) $matches[1] * 1024 ** $exp[mb_strtolower($matches[3])];
55+
} elseif (
56+
$variableType === 'integer'
57+
) {
58+
$value = (int) $value;
5559
} else {
5660
$value = $this->dbi->quoteString($value);
5761
}
@@ -62,8 +66,8 @@ public function __invoke(ServerRequest $request, array $vars): void
6266
// Some values are rounded down etc.
6367
$varValue = $this->dbi->fetchSingleRow(
6468
'SHOW GLOBAL VARIABLES WHERE Variable_name='
65-
. $this->dbi->quoteString($variableName)
66-
. ';',
69+
. $this->dbi->quoteString($variableName)
70+
. ';',
6771
DatabaseInterface::FETCH_NUM,
6872
);
6973
[$formattedValue, $isHtmlFormatted] = $this->formatVariable($variableName, $varValue[1]);

0 commit comments

Comments
 (0)