[DOC-CVS] [doc-en] master: random: `mt_rand()` may throw ValueError since PHP 8.0 (#4660)

[email protected] (Takuya Aramaki via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
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 <[email protected]>

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>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.