[php-src] PHP-8.3: Merge branch 'PHP-8.2' into PHP-8.3
| From: | Tim Düsterhus | Date: | Wed, 13 Mar 2024 19:28:39 +0000 |
| Subject: | [php-src] PHP-8.3: Merge branch 'PHP-8.2' into PHP-8.3 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-127720@lists.php.net to get a copy of this message | ||
Author: Tim Düsterhus (TimWolla)
Date: 2024-03-13T20:14:42+01:00
Commit: https://github.com/php/php-src/commit/0d0375ab91a023d312b9a4e187c68bea69512f53
Raw diff: https://github.com/php/php-src/commit/0d0375ab91a023d312b9a4e187c68bea69512f53.diff
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)
Changed paths:
M NEWS
M ext/random/random.c
Diff:
diff --git a/NEWS b/NEWS
index 004fd30e233cb..182c51160c9c6 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,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 4de08396de40b..57f8f183b2867 100644
--- a/ext/random/random.c
+++ b/ext/random/random.c
@@ -315,6 +315,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;
}