From 67c7e503d97bb61765d3d7309e7a1ebf9acce9d3 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 13 Jul 2021 13:55:00 +0200 Subject: [PATCH] Used lowercase values when trying to match the QR code error level --- module/Core/src/Action/Model/QrCodeParams.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/module/Core/src/Action/Model/QrCodeParams.php b/module/Core/src/Action/Model/QrCodeParams.php index bcde20c6..742d3f07 100644 --- a/module/Core/src/Action/Model/QrCodeParams.php +++ b/module/Core/src/Action/Model/QrCodeParams.php @@ -16,7 +16,6 @@ use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface as Request; use function strtolower; -use function strtoupper; use function trim; final class QrCodeParams @@ -82,12 +81,12 @@ final class QrCodeParams private static function resolveErrorCorrection(array $query): ErrorCorrectionLevelInterface { - $errorCorrectionLevel = strtoupper(trim($query['errorCorrection'] ?? '')); + $errorCorrectionLevel = strtolower(trim($query['errorCorrection'] ?? 'l')); return match ($errorCorrectionLevel) { - 'H' => new ErrorCorrectionLevelHigh(), - 'Q' => new ErrorCorrectionLevelQuartile(), - 'M' => new ErrorCorrectionLevelMedium(), - default => new ErrorCorrectionLevelLow(), // 'L' + 'h' => new ErrorCorrectionLevelHigh(), + 'q' => new ErrorCorrectionLevelQuartile(), + 'm' => new ErrorCorrectionLevelMedium(), + default => new ErrorCorrectionLevelLow(), // 'l' }; }