diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c0cb327867..21e1f84d21 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -7566,12 +7566,6 @@ parameters: count: 2 path: src/Export/Export.php - - - message: '#^Parameter \#3 \$kana of static method PhpMyAdmin\\Encoding\:\:kanjiStrConv\(\) expects string, mixed given\.$#' - identifier: argument.type - count: 1 - path: src/Export/Export.php - - message: ''' #^Call to deprecated method getInstance\(\) of class PhpMyAdmin\\Config\: diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f8e644622a..81518cd584 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1385,7 +1385,6 @@ - @@ -4613,7 +4612,6 @@ - diff --git a/src/Controllers/Export/ExportController.php b/src/Controllers/Export/ExportController.php index 359dc243bd..4de4933133 100644 --- a/src/Controllers/Export/ExportController.php +++ b/src/Controllers/Export/ExportController.php @@ -52,9 +52,6 @@ final class ExportController implements InvocableController $GLOBALS['save_filename'] ??= null; $GLOBALS['time_start'] ??= null; - /** @var array $postParams */ - $postParams = $request->getParsedBody(); - $quickOrCustom = $request->getParsedBodyParamAsStringOrNull('quick_or_custom'); $outputFormat = $request->getParsedBodyParamAsStringOrNull('output_format'); $compressionParam = $request->getParsedBodyParamAsString('compression', ''); @@ -101,7 +98,9 @@ final class ExportController implements InvocableController Export::$tableData = $tableData; } - $this->setGlobalsFromRequest($postParams); + if ($request->hasBodyParam('xkana')) { + Export::$xkana = $request->getParsedBodyParamAsString('xkana'); + } // sanitize this parameter which will be used below in a file inclusion $what = Core::securePath($request->getParsedBodyParamAsString('what', '')); @@ -466,19 +465,4 @@ final class ExportController implements InvocableController return $this->responseFactory->createResponse()->write($this->export->dumpBuffer); } - - /** - * Please keep the parameters in order of their appearance in the form. - * Some of these parameters are not used. - * - * @param mixed[] $postParams - */ - private function setGlobalsFromRequest(array $postParams): void - { - if (! isset($postParams['xkana'])) { - return; - } - - $GLOBALS['xkana'] = $postParams['xkana']; - } } diff --git a/src/Export/Export.php b/src/Export/Export.php index 03003f3e1f..8ce567b8ae 100644 --- a/src/Export/Export.php +++ b/src/Export/Export.php @@ -87,6 +87,7 @@ class Export /** @var resource|null */ public static mixed $fileHandle = null; public static string $kanjiEncoding = ''; + public static string $xkana = ''; public static string $maxSize = ''; public static int $memoryLimit = 0; public static bool $onFlyCompression = false; @@ -155,7 +156,7 @@ class Export // Kanji encoding convert feature if (self::$outputKanjiConversion) { - $line = Encoding::kanjiStrConv($line, self::$kanjiEncoding, $GLOBALS['xkana'] ?? ''); + $line = Encoding::kanjiStrConv($line, self::$kanjiEncoding, self::$xkana); } // If we have to buffer data, we will perform everything at once at the end