diff --git a/NEWS b/NEWS index 4598f8bea75..ea7909695d1 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ PHP NEWS - Random: . Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with unknown modes). (timwolla) + . Fixed bug GH-13690 (Global Mt19937 is not properly reset in-between + requests when MT_RAND_PHP is used). (timwolla) - Session: . Fixed bug GH-13680 (Segfault with session_decode and compilation error). diff --git a/ext/random/random.c b/ext/random/random.c index 9f9da28962d..e30a04259fb 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -334,6 +334,7 @@ PHPAPI php_random_status *php_random_default_status(void) php_random_status *status = RANDOM_G(mt19937); if (!RANDOM_G(mt19937_seeded)) { + ((php_random_status_state_mt19937 *)status->state)->mode = MT_RAND_MT19937; php_random_mt19937_seed_default(status->state); RANDOM_G(mt19937_seeded) = true; }