Skip to content

Commit 0d0375a

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: random: Initialize the `mode` field when seeding in `php_random_default_status()` (#13690)
2 parents b58dc6f + f34721c commit 0d0375a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ PHP NEWS
2929
- Random:
3030
. Fixed bug GH-13544 (Pre-PHP 8.2 compatibility for mt_srand with unknown
3131
modes). (timwolla)
32+
. Fixed bug GH-13690 (Global Mt19937 is not properly reset in-between
33+
requests when MT_RAND_PHP is used). (timwolla)
3234

3335
- Session:
3436
. Fixed bug GH-13680 (Segfault with session_decode and compilation error).

ext/random/random.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ PHPAPI php_random_status *php_random_default_status(void)
315315
php_random_status *status = RANDOM_G(mt19937);
316316

317317
if (!RANDOM_G(mt19937_seeded)) {
318+
((php_random_status_state_mt19937 *)status->state)->mode = MT_RAND_MT19937;
318319
php_random_mt19937_seed_default(status->state);
319320
RANDOM_G(mt19937_seeded) = true;
320321
}

0 commit comments

Comments
 (0)