mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
standard: Stop using php_combined_lcg() in uniqid() (#15217)
Fall back to the fallback generator if the CSPRNG fails instead. This removes the last internal user of `php_combined_lcg()`.
This commit is contained in:
@@ -75,10 +75,9 @@ PHP_FUNCTION(uniqid)
|
||||
uint32_t bytes;
|
||||
double seed;
|
||||
if (php_random_bytes_silent(&bytes, sizeof(uint32_t)) == FAILURE) {
|
||||
seed = php_combined_lcg() * 10;
|
||||
} else {
|
||||
seed = ((double) bytes / UINT32_MAX) * 10.0;
|
||||
bytes = php_random_generate_fallback_seed();
|
||||
}
|
||||
seed = ((double) bytes / UINT32_MAX) * 10.0;
|
||||
uniqid = strpprintf(0, "%s%08x%05x%.8F", prefix, sec, usec, seed);
|
||||
} else {
|
||||
uniqid = strpprintf(0, "%s%08x%05x", prefix, sec, usec);
|
||||
|
||||
Reference in New Issue
Block a user