[doc-en] master: random: `mt_rand()` may throw ValueError since PHP 8.0 (#4660)
| From: | Takuya Aramaki via GitHub | Date: | Wed, 07 May 2025 12:53:44 +0000 |
| Subject: | [doc-en] master: random: `mt_rand()` may throw ValueError since PHP 8.0 (#4660) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-22663@lists.php.net to get a copy of this message | ||
Author: Takuya Aramaki (takaram)
Committer: GitHub (web-flow)
Pusher: TimWolla
Date: 2025-05-07T14:43:00+02:00
Commit: https://github.com/php/doc-en/commit/0a5e7b12546b62a611a0cbc7105e617ab96fbcbd
Raw diff: https://github.com/php/doc-en/commit/0a5e7b12546b62a611a0cbc7105e617ab96fbcbd.diff
random:
mt_rand() may throw ValueError since PHP 8.0 (#4660)
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
Changed paths:
M reference/random/functions/mt-rand.xml
Diff:
diff --git a/reference/random/functions/mt-rand.xml b/reference/random/functions/mt-rand.xml
index fb9d4e0a04db..b4c3a460c825 100644
--- a/reference/random/functions/mt-rand.xml
+++ b/reference/random/functions/mt-rand.xml
@@ -63,10 +63,20 @@
&reftitle.returnvalues;
<para>
A random integer value between <parameter>min</parameter> (or 0)
- and <parameter>max</parameter> (or <function>mt_getrandmax</function>,
inclusive),
- or &false; if <parameter>max</parameter> is less than
<parameter>min</parameter>.
+ and <parameter>max</parameter> (or <function>mt_getrandmax</function>,
inclusive).
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ If <parameter>max</parameter> is less than <parameter>min</parameter>,
a
+ <classname>ValueError</classname> will be thrown.
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ </refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
@@ -79,6 +89,13 @@
</row>
</thead>
<tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <classname>ValueError</classname> will be thrown if
<parameter>max</parameter> is less than <parameter>min</parameter>;
+ previously an <constant>E_WARNING</constant> was raised, and the function
returned &false;.
+ </entry>
+ </row>
<row>
<entry>7.2.0</entry>
<entry>