Skip to content

Commit 258c4df

Browse files
committed
Mark rand/mt_rand args as UNKNOWN
The second argument should be mt_getrandmax(), not PHP_INT_MAX. Additionally this function only accepts either zero or two arguments, so err on the side of being conservative and mark both UNKNOWN.
1 parent 1dcb559 commit 258c4df

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/standard/basic_functions.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,9 +1194,9 @@ function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
11941194
/** @alias mt_srand */
11951195
function srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
11961196

1197-
function rand(int $min = 0, int $max = PHP_INT_MAX): int {}
1197+
function rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
11981198

1199-
function mt_rand(int $min = 0, int $max = PHP_INT_MAX): int {}
1199+
function mt_rand(int $min = UNKNOWN, int $max = UNKNOWN): int {}
12001200

12011201
function mt_getrandmax(): int {}
12021202

ext/standard/basic_functions_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,8 +1827,8 @@ ZEND_END_ARG_INFO()
18271827
#define arginfo_srand arginfo_mt_srand
18281828

18291829
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rand, 0, 0, IS_LONG, 0)
1830-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, min, IS_LONG, 0, "0")
1831-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, max, IS_LONG, 0, "PHP_INT_MAX")
1830+
ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
1831+
ZEND_ARG_TYPE_INFO(0, max, IS_LONG, 0)
18321832
ZEND_END_ARG_INFO()
18331833

18341834
#define arginfo_mt_rand arginfo_rand

0 commit comments

Comments
 (0)