Skip to content

[BUG] Wrong QRDataModeInterface chosen for strings containing comma #324

@thgiang

Description

@thgiang

Issue description

The current Alphanumeric::validateString() regex incorrectly allows the comma character (,) due to an unintended ASCII range caused by an unescaped - inside the character class.

Filename: AlphaNum.php

Current code:
return (bool) preg_match('/^[A-Z\d %$*+-.:\/]+$/', $string);

Expected behavior

Correct code:
return (bool) preg_match('/^[A-Z\d %$*+\-.:\/]+$/', $string);

Code sample

return (bool) preg_match('/^[A-Z\d %$*+\-.:\/]+$/', $string);

Library version

latest

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions