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()`.

(cherry picked from commit 03e84852b4)
This commit is contained in:
Einar Gangsø
2025-09-19 10:41:26 +02:00
committed by smiley
parent 75a29186e6
commit e5145b19a2
+1 -1
View File
@@ -44,7 +44,7 @@ final class AlphaNum extends QRDataModeAbstract{
* @inheritDoc
*/
public static function validateString(string $string):bool{
return (bool)preg_match('/^[A-Z\d %$*+-.:\/]+$/', $string);
return (bool)preg_match('/^[A-Z\d %$*+\-.:\/]+$/', $string);
}
/**