As identified by @znrk (#984), getGuid() is broken.
In fact, it's not only broken on the line identified for clock_seq_low,
but also in 2 other places. mt_rand() is inclusive for both the max and
the min, so mt_rand(0, 256) produces a max value of 0x100 rather than
0xff, overflowing from 2 bits to 3 bits. The fix is simple - changing
the max value on the 3 lines where it's broken to ensure that the
generated GUID is in line with the spec for version 4 (random GUID) at
https://tools.ietf.org/html/rfc4122.
Note that I created a separate commit for the fix and for my tests. If you're opposed to merging my refactoring of getGuid(), I'm happy to create a pull request containing only the 3-line fix commit.
This pull request fixes #984.
As identified by @znrk (#984), getGuid() is broken.
In fact, it's not only broken on the line identified for clock_seq_low, but also in 2 other places. mt_rand() is inclusive for both the max and the min, so mt_rand(0, 256) produces a max value of 0x100 rather than 0xff, overflowing from 2 bits to 3 bits. The fix is simple - changing the max value on the 3 lines where it's broken to ensure that the generated GUID is in line with the spec for version 4 (random GUID) at https://tools.ietf.org/html/rfc4122.
Note that I created a separate commit for the fix and for my tests. If you're opposed to merging my refactoring of getGuid(), I'm happy to create a pull request containing only the 3-line fix commit.