Skip to content

Commit 7517cf3

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
- PHP-8.1: Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3
2 parents 227b3b3 + 3197104 commit 7517cf3

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ PHP NEWS
1010

1111
- Random:
1212
. Fix GH-10390 (Do not trust arc4random_buf() on glibc). (timwolla)
13+
. Fix GH-10292 (Made the default value of the first param of srand() and
14+
mt_srand() unknown). (kocsismate)
1315

1416
- Standard:
1517
- Fixed bug GH-8086 (Introduce mail.mixed_lf_and_crlf INI). (Jakub Zelenka)

ext/random/random.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
function lcg_value(): float {}
1818

19-
function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
19+
function mt_srand(int $seed = UNKNOWN, int $mode = MT_RAND_MT19937): void {}
2020

2121
/** @alias mt_srand */
22-
function srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
22+
function srand(int $seed = UNKNOWN, int $mode = MT_RAND_MT19937): void {}
2323

2424
function rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
2525

ext/random/random_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
GH-10292 (Made the default value of the first param of srand() and mt_srand() unknown
3+
--FILE--
4+
<?php
5+
6+
try {
7+
srand(mode: MT_RAND_MT19937);
8+
} catch (Error $e) {
9+
echo $e->getMessage() . "\n";
10+
}
11+
12+
try {
13+
mt_srand(mode: MT_RAND_MT19937);
14+
} catch (Error $e) {
15+
echo $e->getMessage() . "\n";
16+
}
17+
18+
?>
19+
--EXPECT--
20+
srand(): Argument #1 ($seed) must be passed explicitly, because the default value is not known
21+
mt_srand(): Argument #1 ($seed) must be passed explicitly, because the default value is not known

0 commit comments

Comments
 (0)