Bug #72784 [Asn->Csd]: BC break in rand(): throws warning in 7.1 and returns FALSE for max-min range

From: Date: Wed, 10 Aug 2016 22:41:51 +0000
Subject: Bug #72784 [Asn->Csd]: BC break in rand(): throws warning in 7.1 and returns FALSE for max-min range
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203182@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72784&edit=1

 ID:                 72784
 Updated by:         leigh@php.net
 Reported by:        bugs dot php dot net at majkl578 dot cz
 Summary:            BC break in rand(): throws warning in 7.1 and
                     returns FALSE for max-min range
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            Math related
 PHP Version:        7.1.0beta2
 Assigned To:        leigh
 Block user comment: N
 Private report:     N

 New Comment:

Behaviour restored by commit 9a9004318fa3a5b2c2c3c4a4fafed9ad4767df4a

rand() is relaxed
mt_rand() is strict


Previous Comments:
------------------------------------------------------------------------
[2016-08-10 11:28:08] mbeccati@php.net

Also, see: https://bugs.php.net/bug.php?id=46587

------------------------------------------------------------------------
[2016-08-08 21:21:00] leigh@php.net

For now I've allowed min > max but kept the warning. I'll ping internals too.

------------------------------------------------------------------------
[2016-08-08 20:43:16] cmb@php.net

> I think the easiest course of action is to relax the strict
> min/max ordering on mt_rand().

I wouldn't want this lax behavior in the long run, though. Maybe
allowing it for now with a deprecation notice would be okay.
Probably some discussion on internals is appropriate.

------------------------------------------------------------------------
[2016-08-08 16:08:21] leigh@php.net

This will be a side effect of rand() now being an alias of mt_rand(). So unfortunately both
accidental and intentional.

I think the easiest course of action is to relax the strict min/max ordering on mt_rand().

------------------------------------------------------------------------
[2016-08-08 15:34:49] cmb@php.net

Confirmed: <https://3v4l.org/l7i5e>.

There have been several fixes to rand() et. al. which have been
proprosed as on voted upon in
<https://wiki.php.net/rfc/rng_fixes>.

I'm not sure whether this change was desired, or just by accident.
Leigh?

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=72784


--
Edit this bug report at https://bugs.php.net/bug.php?id=72784&edit=1


Thread (7 messages)

« previous php.bugs (#203182) next »