[doc-en] master: Document DivisionByZeroError on the gmp division functions (#6057)
| From: | Asish Kumar via GitHub | Date: | Wed, 11 Nov 2026 19:11:47 +0000 |
| Subject: | [doc-en] master: Document DivisionByZeroError on the gmp division functions (#6057) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23934@lists.php.net to get a copy of this message | ||
Author: Asish Kumar (officialasishkumar)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-11T20:11:43+01:00
Commit: https://github.com/php/doc-en/commit/7462f779f5459e61f87a49b51a69e3e2dea8250c
Raw diff: https://github.com/php/doc-en/commit/7462f779f5459e61f87a49b51a69e3e2dea8250c.diff
Document DivisionByZeroError on the gmp division functions (#6057)
* Document DivisionByZeroError on the gmp division functions
gmp_div_q(), gmp_div_r(), gmp_div_qr(), gmp_divexact(), gmp_mod() and
gmp_invert() throw a DivisionByZeroError when num2 is 0 (see
ext/gmp/gmp.c), but unlike gmp_powm() their pages had no Errors section.
Add one to each, including the pre-8.0.0 E_WARNING behaviour, mirroring
the wording used on gmp_powm().
Fixes #6053
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
* Fix pre-8.0.0 behaviour on gmp_invert() zero modulus
---------
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Changed paths:
M reference/gmp/functions/gmp-div-q.xml
M reference/gmp/functions/gmp-div-qr.xml
M reference/gmp/functions/gmp-div-r.xml
M reference/gmp/functions/gmp-divexact.xml
M reference/gmp/functions/gmp-invert.xml
M reference/gmp/functions/gmp-mod.xml
Diff:
diff --git a/reference/gmp/functions/gmp-div-q.xml b/reference/gmp/functions/gmp-div-q.xml
index 9a7ce181faea..6342888d4eb6 100644
--- a/reference/gmp/functions/gmp-div-q.xml
+++ b/reference/gmp/functions/gmp-div-q.xml
@@ -84,6 +84,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was raised instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/gmp/functions/gmp-div-qr.xml b/reference/gmp/functions/gmp-div-qr.xml
index e853605b15d0..6997db25f6c0 100644
--- a/reference/gmp/functions/gmp-div-qr.xml
+++ b/reference/gmp/functions/gmp-div-qr.xml
@@ -64,6 +64,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was raised instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/gmp/functions/gmp-div-r.xml b/reference/gmp/functions/gmp-div-r.xml
index 5e6fb897c841..9c533991ff47 100644
--- a/reference/gmp/functions/gmp-div-r.xml
+++ b/reference/gmp/functions/gmp-div-r.xml
@@ -64,6 +64,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was raised instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/gmp/functions/gmp-divexact.xml b/reference/gmp/functions/gmp-divexact.xml
index a7f204e09daf..9a5d5f41972a 100644
--- a/reference/gmp/functions/gmp-divexact.xml
+++ b/reference/gmp/functions/gmp-divexact.xml
@@ -54,6 +54,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was raised instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/gmp/functions/gmp-invert.xml b/reference/gmp/functions/gmp-invert.xml
index a0a1b5b6b242..d02093ce616b 100644
--- a/reference/gmp/functions/gmp-invert.xml
+++ b/reference/gmp/functions/gmp-invert.xml
@@ -46,6 +46,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, &false; was returned instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>
diff --git a/reference/gmp/functions/gmp-mod.xml b/reference/gmp/functions/gmp-mod.xml
index 34e1acdfe964..2b00817fcc2d 100644
--- a/reference/gmp/functions/gmp-mod.xml
+++ b/reference/gmp/functions/gmp-mod.xml
@@ -50,6 +50,17 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>DivisionByZeroError</exceptionname> if
+ <parameter>num2</parameter> is <literal>0</literal>.
+ </simpara>
+ <simpara>
+ Prior to PHP 8.0.0, an <constant>E_WARNING</constant> was raised instead.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<para>