Skip to content

Commit

Permalink
Add rand() to ext/standard stub
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Feb 21, 2020
1 parent 3e1ac7e commit 1892def
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(proc_nice, arginfo_proc_nice)
#endif

PHP_FE(rand, arginfo_mt_rand)
PHP_FE(rand, arginfo_rand)
PHP_FALIAS(srand, mt_srand, arginfo_srand)
PHP_FALIAS(getrandmax, mt_getrandmax, arginfo_getrandmax)
PHP_FE(mt_rand, arginfo_mt_rand)
Expand Down
2 changes: 2 additions & 0 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,8 @@ function mt_srand(int $seed = 0, int $mode = MT_RAND_MT19937): void {}

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

function rand(int $min = 0, int $max = PHP_INT_MAX): int {}

function mt_rand(int $min = 0, int $max = PHP_INT_MAX): int {}

function mt_getrandmax(): int {}
Expand Down
4 changes: 3 additions & 1 deletion ext/standard/basic_functions_arginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1831,11 +1831,13 @@ ZEND_END_ARG_INFO()

#define arginfo_srand arginfo_mt_srand

ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_mt_rand, 0, 0, IS_LONG, 0)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rand, 0, 0, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, min, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, max, IS_LONG, 0)
ZEND_END_ARG_INFO()

#define arginfo_mt_rand arginfo_rand

#define arginfo_mt_getrandmax arginfo_ob_get_level

#define arginfo_getrandmax arginfo_ob_get_level
Expand Down

0 comments on commit 1892def

Please sign in to comment.