Skip to content

[UUID] Bug with Ramsey\UUID uuid_binary Doctrine type #1309

Description

@dkarlovi

If using Ramsey Doctrine UUID uuid_binary datatype, identifiers in motion are classic UUID strings (ie. 5e619188-b5c8-4797-905e-05f4ba6dfc67) but they're binary at rest (ie. 0xFEFDF85691AE48E2888D39C3EBEC352F).

In IdentifierManagerTrait, a statement tries to convert the user-supplied identifier to a PHP value, which means it tries to convert the input as if it's binary, NOT string. This fails, obviously. If I change it to convertToDatabaseValue(), it works as expected.

This brings up another question, if the ID provided is not decodable (not a valid UUID, for example), how should that be treated? I guess as a 404, not as a 500.

/cc @teohhanhui

TLDR

GET http://127.0.0.1:8000/api/images/5e619188-b5c8-4797-905e-05f4ba6dfc67

{
    "type": "https://tools.ietf.org/html/rfc2616#section-10",
    "title": "An error occurred",
    "detail": "Could not convert database value \"5e619188-b5c8-4797-9...\" to Doctrine Type uuid_binary"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions