Bug #78093 [Opn->Nab]: mt_rand returns NULL in some cases

From: Date: Fri, 31 May 2019 14:51:46 +0000
Subject: Bug #78093 [Opn->Nab]: mt_rand returns NULL in some cases
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221066@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78093&edit=1 ID: 78093 Updated by: requinix@php.net Reported by: sidorovmarat1995 at gmail dot com Summary: mt_rand returns NULL in some cases -Status: Open +Status: Not a bug Type: Bug Package: Math related Operating System: All PHP Version: 7.2.19 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php https://3v4l.org/TviI3 See the warnings? https://www.php.net/manual/en/functions.internal.php > Note: If the parameters given to a function are not what it expects, such as passing an array > where a string is > expected, the return value of the function is undefined. In this case it will likely return > NULL but this is just > a convention, and cannot be relied upon. Previous Comments: ------------------------------------------------------------------------ [2019-05-31 14:50:53] sidorovmarat1995 at gmail dot com Sorry, I don't know how to fix this issue. And you can see my path is only random txt file from my PC. ------------------------------------------------------------------------ [2019-05-31 14:48:20] sidorovmarat1995 at gmail dot com The following patch has been added/updated: Patch Name: mt-rand Revision: 1559314100 URL: https://bugs.php.net/patch-display.php?bug=78093&patch=mt-rand&revision=1559314100 ------------------------------------------------------------------------ [2019-05-31 14:47:30] sidorovmarat1995 at gmail dot com Description: ------------ In mt_rand docs I can't find possibility of returning NULL. I suggest return false in this situation(see test script). Test script: --------------- <?php var_dump(mt_rand(INF,INF)); var_dump(mt_rand(INF,NULL)); Expected result: ---------------- bool(false) bool(false) Actual result: -------------- NULL NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78093&edit=1

« previous php.bugs (#221066) next »