diff --git a/NEWS b/NEWS index df3ab007f7dfa..29201f1cf565a 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ PHP NEWS - Random: . Fixed bug GH-9415 (Randomizer::getInt(0, 2**32 - 1) with Mt19937 always returns 1). (timwolla) + . Fixed Randomizer::getInt() consistency for 32-bit engines. (timwolla) - Streams: . Fixed bug GH-9316 ($http_response_header is wrong for long status line). diff --git a/ext/random/random.c b/ext/random/random.c index b0cf8cb6f2c1a..2380a83b75890 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -313,7 +313,7 @@ PHPAPI zend_long php_random_range(const php_random_algo *algo, php_random_status { zend_ulong umax = (zend_ulong) max - (zend_ulong) min; - if (algo->generate_size == 0 || algo->generate_size > sizeof(uint32_t) || umax > UINT32_MAX) { + if (umax > UINT32_MAX) { return (zend_long) (rand_range64(algo, status, umax) + min); }