diff options
author | Nils Adermann <naderman@naderman.de> | 2011-06-05 03:22:40 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-06-05 03:22:40 +0200 |
commit | b55bfb459e70bd636033b32d65e3436a006acac7 (patch) | |
tree | ee99e5b714c28a55344f73f3b5fc68a5a0ec5d7b /phpBB/includes/functions.php | |
parent | Merge branch 'develop-olympus' into develop (diff) | |
parent | Merge branch 'ticket/bantu/10042' into develop-olympus (diff) | |
download | phpbb-b55bfb459e70bd636033b32d65e3436a006acac7.tar.gz phpbb-b55bfb459e70bd636033b32d65e3436a006acac7.tar.bz2 phpbb-b55bfb459e70bd636033b32d65e3436a006acac7.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10042] GD CAPTCHA: Call phpbb_mt_rand() where required.
[ticket/10042] GD CAPTCHA: Round offset to the next pixel.
[ticket/10042] Add mt_rand() wrapper which allows swapping $min and $max.
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index de150b9fcb..b22634ce88 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -191,6 +191,22 @@ function unique_id($extra = 'c') } /** +* Wrapper for mt_rand() which allows swapping $min and $max parameters. +* +* PHP does not allow us to swap the order of the arguments for mt_rand() anymore. +* (since PHP 5.3.4, see http://bugs.php.net/46587) +* +* @param int $min Lowest value to be returned +* @param int $max Highest value to be returned +* +* @return int Random integer between $min and $max (or $max and $min) +*/ +function phpbb_mt_rand($min, $max) +{ + return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max); +} + +/** * Return formatted string for filesizes * * @param int $value filesize in bytes |