[doc-en] master: filter: document the exceptions of filter_var(), filter_input(), filter_has_var(), and the array variants (#6090)
| From: | Alejandro Borrego via GitHub | Date: | Mon, 16 Nov 2026 17:56:50 +0000 |
| Subject: | [doc-en] master: filter: document the exceptions of filter_var(), filter_input(), filter_has_var(), and the array variants (#6090) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23966@lists.php.net to get a copy of this message | ||
Author: Alejandro Borrego (abp002)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-16T18:56:47+01:00
Commit: https://github.com/php/doc-en/commit/d5e14b9107cacb7d7257ebcf4beec48e0ea741bc
Raw diff: https://github.com/php/doc-en/commit/d5e14b9107cacb7d7257ebcf4beec48e0ea741bc.diff
filter: document the exceptions of filter_var(), filter_input(), filter_has_var(), and the array
variants (#6090)
* filter: document the exceptions of filter_var(), filter_input(), filter_has_var(), and the array
variants
* Apply suggestions from code review
Co-authored-by: Louis-Arnaud <20201470+lacatoire@users.noreply.github.com>
---------
Co-authored-by: Alejandro Borrego <210245044+abp002@users.noreply.github.com>
Co-authored-by: Louis-Arnaud <20201470+lacatoire@users.noreply.github.com>
Changed paths:
M reference/filter/functions/filter-has-var.xml
M reference/filter/functions/filter-input-array.xml
M reference/filter/functions/filter-input.xml
M reference/filter/functions/filter-var-array.xml
M reference/filter/functions/filter-var.xml
Diff:
diff --git a/reference/filter/functions/filter-has-var.xml
b/reference/filter/functions/filter-has-var.xml
index f452db1717f1..9316268ddbe0 100644
--- a/reference/filter/functions/filter-has-var.xml
+++ b/reference/filter/functions/filter-has-var.xml
@@ -45,6 +45,40 @@
</para>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
+ <parameter>input_type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <exceptionname>ValueError</exceptionname> is now thrown if
+ <parameter>input_type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants;
+ previously, &false; was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
diff --git a/reference/filter/functions/filter-input-array.xml
b/reference/filter/functions/filter-input-array.xml
index 48edf7a795c4..54686939ed79 100644
--- a/reference/filter/functions/filter-input-array.xml
+++ b/reference/filter/functions/filter-input-array.xml
@@ -73,6 +73,66 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
+ <parameter>type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants.
+ </simpara>
+ <simpara>
+ If the input array designated by <parameter>type</parameter> is populated,
+ throws a <exceptionname>TypeError</exceptionname> if
+ <parameter>options</parameter> is an &array; with a key that is not a
+ &string;, and a <exceptionname>ValueError</exceptionname> if it has an empty
+ key.
+ </simpara>
+ <simpara>
+ As of PHP 8.5.0, throws a
+ <exceptionname>Filter\FilterFailedException</exceptionname> if the
+ <constant>FILTER_THROW_ON_FAILURE</constant> flag is used for an entry
+ present in the input array and its filter fails,
+ and a <exceptionname>ValueError</exceptionname> if that flag is used together
+ with <constant>FILTER_NULL_ON_FAILURE</constant> for such an entry.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <exceptionname>ValueError</exceptionname> is now thrown if
+ <parameter>type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants;
+ previously, the input array was treated as not populated.
+ </entry>
+ </row>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ If the input array designated by <parameter>type</parameter> is
+ populated, a <exceptionname>TypeError</exceptionname> is now thrown if
+ <parameter>options</parameter> has a key that is not a &string;,
+ and a <exceptionname>ValueError</exceptionname> if it has an empty key;
+ previously, an <constant>E_WARNING</constant> was emitted and &false;
+ was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<example>
diff --git a/reference/filter/functions/filter-input.xml
b/reference/filter/functions/filter-input.xml
index 8caf1d4c0049..ea3261168a49 100644
--- a/reference/filter/functions/filter-input.xml
+++ b/reference/filter/functions/filter-input.xml
@@ -62,6 +62,49 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>ValueError</exceptionname> if
+ <parameter>type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants.
+ </simpara>
+ <simpara>
+ As of PHP 8.5.0, throws a
+ <exceptionname>Filter\FilterFailedException</exceptionname> if the
+ <constant>FILTER_THROW_ON_FAILURE</constant> flag is used and
+ either the filter fails or the
+ <parameter>var_name</parameter> variable is not set,
+ and a <exceptionname>ValueError</exceptionname> if that flag is used together
+ with <constant>FILTER_NULL_ON_FAILURE</constant>.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <exceptionname>ValueError</exceptionname> is now thrown if
+ <parameter>type</parameter> is not one of the
+ <constant>INPUT_<replaceable>*</replaceable></constant> constants;
+ previously, the variable was treated as not set.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<example>
diff --git a/reference/filter/functions/filter-var-array.xml
b/reference/filter/functions/filter-var-array.xml
index 5e99d93a2460..8546e6ebc259 100644
--- a/reference/filter/functions/filter-var-array.xml
+++ b/reference/filter/functions/filter-var-array.xml
@@ -102,6 +102,50 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ Throws a <exceptionname>TypeError</exceptionname> if
+ <parameter>options</parameter> is an &array; with a key that is not a
+ &string;, and a <exceptionname>ValueError</exceptionname> if it has an empty
+ key.
+ </simpara>
+ <simpara>
+ As of PHP 8.5.0, throws a
+ <exceptionname>Filter\FilterFailedException</exceptionname> if the
+ <constant>FILTER_THROW_ON_FAILURE</constant> flag is used for an entry
+ present in <parameter>array</parameter> and its filter fails,
+ and a <exceptionname>ValueError</exceptionname> if that flag is used together
+ with <constant>FILTER_NULL_ON_FAILURE</constant> for such an entry.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="changelog">
+ &reftitle.changelog;
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>&Version;</entry>
+ <entry>&Description;</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>8.0.0</entry>
+ <entry>
+ A <exceptionname>TypeError</exceptionname> is now thrown if
+ <parameter>options</parameter> has a key that is not a &string;,
+ and a <exceptionname>ValueError</exceptionname> if it has an empty key;
+ previously, an <constant>E_WARNING</constant> was emitted and &false;
+ was returned.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<example>
diff --git a/reference/filter/functions/filter-var.xml b/reference/filter/functions/filter-var.xml
index ee1b98f14d5b..a5302045a08e 100644
--- a/reference/filter/functions/filter-var.xml
+++ b/reference/filter/functions/filter-var.xml
@@ -89,6 +89,18 @@
</simpara>
</refsect1>
+ <refsect1 role="errors">
+ &reftitle.errors;
+ <simpara>
+ As of PHP 8.5.0, throws a
+ <exceptionname>Filter\FilterFailedException</exceptionname> if the
+ <constant>FILTER_THROW_ON_FAILURE</constant> flag is used and
+ the filter fails,
+ and a <exceptionname>ValueError</exceptionname> if that flag is used together
+ with <constant>FILTER_NULL_ON_FAILURE</constant>.
+ </simpara>
+ </refsect1>
+
<refsect1 role="examples">
&reftitle.examples;
<example>