Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Uuid::isValid() and Uuid() constraint does not accept other format of uuid than rfc4122 #45148

Copy link
Copy link
Closed
@hracik

Description

@hracik
Issue body actions

Description

When I use Uid component to create uuid there are several string versions and Uuid::fromString("4oTFxYQsVAJZgKJBeSCKVb") accepts any of them and recreates the whole Uuid object.

Symfony\Component\Uid\UuidV6 {#3618 ▼
  #uid: "1ec7cfb7-e1a9-6c5a-b08f-3fa102f64a6a"
  toBase58: "4oTFxYQsVAJZgKJBeSCKVb"
  toBase32: "0YRZ7VFRD9DHDB13SZM41FCJKA"
  time: "2022-01-24 09:53:33.595145 UTC"
}

But Uuid() constraint and Uuid::isValid() checks only against "rfc4122" format.

Uuid::isValid("4oTFxYQsVAJZgKJBeSCKVb"); // false
Uuid::fromString("4oTFxYQsVAJZgKJBeSCKVb"); //works

When project shares in public (for example in URLs) base58 version, then it possibly need to validate the request against the same format and at the moment only option to do it is try/catching Uuid::fromString.

Would be ok to allow optional "format" variable in the constraint and also in the isValid method? Default can stay rfc4122; but also checks against base58 and base32 would be allowed.

Example

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.