Skip to content

Commit 1892def

Browse files
committed
Add rand() to ext/standard stub
1 parent 3e1ac7e commit 1892def

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

ext/standard/basic_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
275275
PHP_FE(proc_nice, arginfo_proc_nice)
276276
#endif
277277

278-
PHP_FE(rand, arginfo_mt_rand)
278+
PHP_FE(rand, arginfo_rand)
279279
PHP_FALIAS(srand, mt_srand, arginfo_srand)
280280
PHP_FALIAS(getrandmax, mt_getrandmax, arginfo_getrandmax)
281281
PHP_FE(mt_rand, arginfo_mt_rand)

ext/standard/basic_functions.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,8 @@ function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
11881188

11891189
function srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}
11901190

1191+
function rand(int $min = 0, int $max = PHP_INT_MAX): int {}
1192+
11911193
function mt_rand(int $min = 0, int $max = PHP_INT_MAX): int {}
11921194

11931195
function mt_getrandmax(): int {}

ext/standard/basic_functions_arginfo.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,11 +1831,13 @@ ZEND_END_ARG_INFO()
18311831

18321832
#define arginfo_srand arginfo_mt_srand
18331833

1834-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mt_rand, 0, 0, IS_LONG, 0)
1834+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rand, 0, 0, IS_LONG, 0)
18351835
ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
18361836
ZEND_ARG_TYPE_INFO(0, max, IS_LONG, 0)
18371837
ZEND_END_ARG_INFO()
18381838

1839+
#define arginfo_mt_rand arginfo_rand
1840+
18391841
#define arginfo_mt_getrandmax arginfo_ob_get_level
18401842

18411843
#define arginfo_getrandmax arginfo_ob_get_level

0 commit comments

Comments
 (0)