Fix rand_range32() for umax = UINT32_MAX (#9416)

* Fix rand_range32() for umax = UINT32_MAX

This was introduced in the commit that added the random extension:
4d8dd8d258.

Resolves GH-9415

* [ci skip] Rename `$r` to `$randomizer` in gh9415.phpt

* Make gh9415.phpt deterministic

* Make gh9415.phpt compatible with 32-bit
This commit is contained in:
Tim Düsterhus 2022-08-24 14:25:51 +02:00 committed by GitHub
parent b78c087b32
commit 0f696e2934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 1 deletions

View file

@ -107,7 +107,7 @@ static inline uint32_t rand_range32(const php_random_algo *algo, php_random_stat
/* Special case where no modulus is required */
if (UNEXPECTED(umax == UINT32_MAX)) {
return true;
return result;
}
/* Increment the max so range is inclusive of max */