uuid icon indicating copy to clipboard operation
uuid copied to clipboard

Cannot get Hex from Guid

Open prolic opened this issue 5 years ago • 2 comments

To Reproduce...

$factory = new UuidFactory(new FeatureSet(true));
$guid = $factory->uuid4();
$hex= $guid->getHex();

Throws:

Ramsey\Uuid\Exception\InvalidArgumentException: The byte string received does not contain a valid version

prolic avatar May 02 '20 04:05 prolic

ping @ramsey

enumag avatar Nov 26 '20 14:11 enumag

The problem is that version is fetched from a different byte between the Guid Fields implementation and normal Fields implementation.

This difference is however not addressed in UuidFactory. As a result the version is in a different byte than where Guid Fields expects it.

I'm not sure what's the correct fix though. What is the correct bytes representation for GUIDs?

enumag avatar Nov 26 '20 14:11 enumag