1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Files
archived-php-src/ext
Tim Düsterhus 7f0b228f48 Fix pre-PHP 8.2 compatibility for php_mt_rand_range() with MT_RAND_PHP (#9839)
* Fix pre-PHP 8.2 compatibility for php_mt_rand_range() with MT_RAND_PHP

As some left-over comments indicated:

> Legacy mode deliberately not inside php_mt_rand_range()
> to prevent other functions being affected

The broken scaler was only used for `php_mt_rand_common()`, not
`php_mt_rand_range()`. The former is only used for `mt_rand()`, whereas the
latter is used for `array_rand()` and others.

With the refactoring for the introduction of ext/random `php_mt_rand_common()`
and `php_mt_rand_range()` were accidentally unified, thus introducing a
behavioral change that was reported in FakerPHP/Faker#528.

This commit moves the checks for `MT_RAND_PHP` from the general-purpose
`range()` function back into `php_mt_rand_common()` and also into
`Randomizer::getInt()` for drop-in compatibility with `mt_rand()`.

* [ci skip] NEWS for `MT_RAND_PHP` compatibility
2022-10-28 16:52:43 +02:00
..
2022-06-25 07:40:19 +01:00
2022-10-27 14:42:17 +01:00
2022-10-20 10:50:03 +02:00
2022-10-27 14:42:17 +01:00
2022-10-10 11:25:33 +03:00
2022-10-24 15:02:55 +02:00
2022-10-21 00:05:35 -06:00
2022-09-27 23:32:37 +02:00
2022-09-06 10:34:10 +01:00
2022-10-25 13:03:55 +02:00
2022-08-26 14:59:59 +02:00
2022-07-28 21:09:18 +02:00
2022-06-09 13:42:45 +02:00
2022-09-27 18:45:54 +02:00
2022-10-13 16:08:34 +02:00
2022-09-29 15:01:39 +03:00