Bug #53403 [Asn->Csd]: mt_rand() without min/max uses invalid min/max values
| From: | cataphract@php.net | Date: | Thu, 25 Nov 2010 16:44:37 +0000 |
| Subject: | Bug #53403 [Asn->Csd]: mt_rand() without min/max uses invalid min/max values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-156446@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53403&edit=1
ID: 53403
Updated by: cataphract@php.net
Reported by: php-bugs at thequod dot de
Summary: mt_rand() without min/max uses invalid min/max
values
-Status: Assigned
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Linux
PHP Version: 5.3SVN-2010-11-25 (snap)
Assigned To: cataphract
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2010-11-25 17:44:22] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=305754
Log: - Fixed bug #53403 (use of unitialized values). Fixes the fix for
bug #46587.
- Added test for bug #46587.
------------------------------------------------------------------------
[2010-11-25 14:15:35] php-bugs at thequod dot de
Fixed title.
------------------------------------------------------------------------
[2010-11-25 14:13:04] php-bugs at thequod dot de
The following works btw:
var_dump(mt_Rand(0, mt_getrandmax()));
------------------------------------------------------------------------
[2010-11-25 14:11:24] php-bugs at thequod dot de
Description:
------------
I am getting the following warning when calling mt_rand() on
5.3.4RC2-dev (snapshot 201011231530), and it returns false:
PHP Warning: mt_rand(): max(-1080344744) is smaller than
min(137322600)
This is on a 32bit Linux container running on a 64bit host (OpenVZ).
Test script:
---------------
var_dump(mt_rand(), mt_getrandmax());
Actual result:
--------------
bool(false)
int(2147483647)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53403&edit=1