Skip to content
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

Incompatibility with ramsey/uuid 4.1 #152

Closed
janlanger opened this issue Jul 31, 2020 · 5 comments
Closed

Incompatibility with ramsey/uuid 4.1 #152

janlanger opened this issue Jul 31, 2020 · 5 comments

Comments

@janlanger
Copy link

The UuidBinaryOrderedTimeType is incompatible with latest ramsey/uuid 4.1, when using Doctrine Second Level cache. Uuid loaded from DB has type Ramsey\Uuid\Rfc4122\UuidV1, but when this type is serialized/deserialized (in caching), type conversion fails with Could not convert database value "11ead339-8a48-dd88-a..." to Doctrine Type uuid_binary_ordered_time. Expected format: UuidV1

Sample:

$uuid = Uuid::uuid1();
$type = new UuidBinaryOrderedTimeType();
$platform = new MySQL80Platform();

var_dump(get_class($uuid), $uuid->getVersion()); //LazyUuidFromString, 1
$dbValue = $type->convertToDatabaseValue($uuid, $platform);
$phpValue = $type->convertToPHPValue($dbValue, $platform);

var_dump(get_class($phpValue), $phpValue->getVersion()); // Rfc4122\UuidV1, 1

$unserialized = unserialize(serialize($phpValue));  // simulating uuid loaded from cache

var_dump(get_class($unserialized), $unserialized->getVersion()); // Rfc4122\UuidV1, NULL
$type->convertToDatabaseValue($unserialized, $platform); // throws exception

Probably related to ramsey/uuid#324, not sure if it is issue there or here...

@ramsey
Copy link
Owner

ramsey commented Jul 31, 2020

Thanks for reporting. This is related to ramsey/uuid#327

@stof
Copy link

stof commented Aug 17, 2020

which version of the the library are you using ?

@janlanger
Copy link
Author

@stof the issue is on uuid:4.1 with uuid-doctrine:1.6

@537mfb
Copy link

537mfb commented Oct 26, 2020

see if the discussion in ramsey/uuid#329 helps

@ramsey
Copy link
Owner

ramsey commented Nov 8, 2021

Upgrading to ramsey/uuid 4.2 should fix this. If not, please let me know.

@ramsey ramsey closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants