summaryrefslogtreecommitdiff
path: root/ext/standard/basic_functions.c
diff options
context:
space:
mode:
authorLeigh <leigh@php.net>2016-07-05 11:54:07 +0100
committerLeigh <leigh@php.net>2016-07-05 11:54:07 +0100
commit7981a294bd2fb329d404001c369517e2953b92a6 (patch)
treef1d47a0087e106a4bb8aadc7d6a567d9f38bef34 /ext/standard/basic_functions.c
parenteba6e7ce9ac721b072ee3afb1cae883b774f3714 (diff)
downloadphp-git-7981a294bd2fb329d404001c369517e2953b92a6.tar.gz
Fix mt_rand impl. Provide legacy impl. access.
Diffstat (limited to 'ext/standard/basic_functions.c')
-rw-r--r--ext/standard/basic_functions.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 55e1f7e2eb..e712d76216 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -35,6 +35,7 @@
#include "zend_operators.h"
#include "ext/standard/php_dns.h"
#include "ext/standard/php_uuencode.h"
+#include "ext/standard/php_mt_rand.h"
#ifdef PHP_WIN32
#include "win32/php_win32_globals.h"
@@ -1887,24 +1888,29 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_srand, 0, 0, 0)
ZEND_ARG_INFO(0, seed)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_srand, 0, 0, 0)
- ZEND_ARG_INFO(0, seed)
-ZEND_END_ARG_INFO()
-
ZEND_BEGIN_ARG_INFO_EX(arginfo_rand, 0, 0, 0)
ZEND_ARG_INFO(0, min)
ZEND_ARG_INFO(0, max)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO(arginfo_getrandmax, 0)
+ZEND_END_ARG_INFO()
+/* }}} */
+/* {{{ mt_rand.c */
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_srand, 0, 0, 0)
+ ZEND_ARG_INFO(0, seed)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_rand, 0, 0, 0)
ZEND_ARG_INFO(0, min)
ZEND_ARG_INFO(0, max)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_getrandmax, 0)
+ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_mt_getrandmax, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mt_rand_mode, 0, 0, 1)
+ ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
/* }}} */
/* {{{ random.c */
@@ -2865,6 +2871,7 @@ const zend_function_entry basic_functions[] = { /* {{{ */
PHP_FE(mt_rand, arginfo_mt_rand)
PHP_FE(mt_srand, arginfo_mt_srand)
PHP_FE(mt_getrandmax, arginfo_mt_getrandmax)
+ PHP_FE(mt_rand_mode, arginfo_mt_rand_mode)
PHP_FE(random_bytes, arginfo_random_bytes)
PHP_FE(random_int, arginfo_random_int)
@@ -3479,6 +3486,7 @@ static void basic_globals_ctor(php_basic_globals *basic_globals_p) /* {{{ */
{
BG(rand_is_seeded) = 0;
BG(mt_rand_is_seeded) = 0;
+ BG(mt_rand_mode) = MT_RAND_MT19937;
BG(umask) = -1;
BG(next) = NULL;
BG(left) = -1;
@@ -3660,6 +3668,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
BASIC_MINIT_SUBMODULE(standard_filters)
BASIC_MINIT_SUBMODULE(user_filters)
BASIC_MINIT_SUBMODULE(password)
+ BASIC_MINIT_SUBMODULE(mt_rand)
#if defined(HAVE_LOCALECONV) && defined(ZTS)
BASIC_MINIT_SUBMODULE(localeconv)