Re: mt_rand() behavior change is not in UPGRADING
| From: | Nikita Popov | Date: | Thu, 14 May 2015 08:55:43 +0000 |
| Subject: | Re: mt_rand() behavior change is not in UPGRADING | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86211@lists.php.net to get a copy of this message | ||
On Thu, May 14, 2015 at 10:13 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all,
>
> It's nice to see mt_rand() behavior is improved.
>
> [yohgaki@dev ~]$ php-5.6 -r "var_dump(mt_rand(222,
> '99999999999999999999999'));"
> int(115282844144104926)
> [yohgaki@dev ~]$ php-7.0 -r "var_dump(mt_rand(222,
> '99999999999999999999999'));"
>
> Warning: mt_rand() expects parameter 2 to be integer, string given in
> Command line code on line 1
> NULL
>
> However, returning NULL for invalid range may result in serious issues.
> It's not documented in UPGRADING.
>
> Could anyone responsible take care of it?
> I suppose mt_srand() behavior has changed also.
> There may be others.
>
This change is not mt_rand specific, it applies to all internal functions.
See https://wiki.php.net/rfc/zpp_fail_on_overflow.
You are right that it is
not mentioned in UPGRADING yet.
Nikita