From 03e84852b4e8394444eadc71ae3c66c19edf954f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Gangs=C3=B8?= Date: Fri, 19 Sep 2025 10:41:26 +0200 Subject: [PATCH] Do not use AlphaNum when string contains comma Using dash in this context will create a range between `+` and `.` which allows the following characters: `+`, `,`, `-`, `.`. The ASCII range is as follow: + (43), , (44), - (45), . (46). Comma is not supported and will then crash in `write()`. --- src/Data/AlphaNum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/AlphaNum.php b/src/Data/AlphaNum.php index 961d6b774..e19467b73 100644 --- a/src/Data/AlphaNum.php +++ b/src/Data/AlphaNum.php @@ -36,7 +36,7 @@ final class AlphaNum extends QRDataModeAbstract{ } public static function validateString(string $string):bool{ - return (bool)preg_match('/^[A-Z\d %$*+-.:\/]+$/', $string); + return (bool)preg_match('/^[A-Z\d %$*+\-.:\/]+$/', $string); } public function write(BitBuffer $bitBuffer, int $versionNumber):static{