Azure/azure-sdk-for-php

I found bug in function getGuid().

znrk opened this issue · 1 comments

znrk commented

I found bug in function getGuid.

mt_rand(0, 256), // 8 bits for "clock_seq_low"

clock_seq_low must be two-digits hex string, but when mt_rand() returns 256. it will be a three-digits hex string (256 = 0x100).
With this don't generate correct GUID.
eg; b4d8316b-36ef-4c9d-85100-17fe2ece51ba

please fix, changing mt_rand() max from 256 to 255.

same code wrotein following files;
azure-sdk-for-php/examples/vendor/microsoft/windowsazure/WindowsAzure/Common/Internal/Utilities.php
azure-sdk-for-php/src/Common/Internal/Utilities.php
azure-sdk-for-php/vendor/microsoft/azure-storage/src/Common/Internal/Utilities.php

I was able to confirm the bug, and opened a pull request (#988) to fix it.