Skip to content

[Uid] isValid fails when passing non Rfc4122 IDs #57398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KDederichs opened this issue Jun 14, 2024 · 3 comments · Fixed by #57940
Closed

[Uid] isValid fails when passing non Rfc4122 IDs #57398

KDederichs opened this issue Jun 14, 2024 · 3 comments · Fixed by #57940

Comments

@KDederichs
Copy link
Contributor

Symfony version(s) affected

7.1.1

Description

When trying to validate UUIDs in a format that's not Rfc4122 it'll always fail.

How to reproduce

Uuid::isValid("1CCD2w4mK2m455S2BAXFht"); //should be true since it's a valid UUIDv7 in base58 format.

Possible Solution

The isValid seems to contain a regex that checks for the Rfc4122 structure, probably should be expanded to check the other representations as well.

Additional Context

No response

@KDederichs KDederichs added the Bug label Jun 14, 2024
@KDederichs KDederichs changed the title [Uuid] isValid fails when passing non Rfc4122 IDs [Uid] isValid fails when passing non Rfc4122 IDs Jun 14, 2024
@xabbuh xabbuh added the Uid label Jun 14, 2024
@derrabus
Copy link
Member

I understand that you want to validate UIDs in representations other than RFC 4122, but the fact that the isValid() does not support your favorite representation (yet?) is certainly not a bug.

@derrabus derrabus added Feature and removed Bug labels Jun 14, 2024
@KDederichs
Copy link
Contributor Author

well depends on how you look at it, since it's not saying it has to be RFC 4122 anywhere but yeah, if you look at it like that it's a feature request to extend isValid to work with all the supported representations

@kaznovac
Copy link
Contributor

related: #51540

nicolas-grekas added a commit that referenced this issue Jun 25, 2024
…traint to allow accepting different ULID formats (alexandre-daubois)

This PR was merged into the 7.2 branch.

Discussion
----------

[Validator] Add the `format` option to the `Ulid` constraint to allow accepting different ULID formats

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Issues        | -
| License       | MIT

Related to #51540 and #57398

Commits
-------

880e8fa [Validator] Add the `format` option to the `Uuid` constraint to allow accepting different ULID formats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment