[doc-en] master: `FILTER_VALIDATE_DOMAIN`: document acceptance of arbitrary characters (#5867)

From: Date: Mon, 28 Sep 2026 05:13:51 +0000
Subject: [doc-en] master: `FILTER_VALIDATE_DOMAIN`: document acceptance of arbitrary characters (#5867)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23786@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Committer: GitHub (web-flow) Pusher: DanielEScherzer Date: 2026-09-27T22:13:48-07:00 Commit: https://github.com/php/doc-en/commit/74492d20fff2f42c8aef4ba02f4bf4b59e2f8fcc Raw diff: https://github.com/php/doc-en/commit/74492d20fff2f42c8aef4ba02f4bf4b59e2f8fcc.diff FILTER_VALIDATE_DOMAIN: document acceptance of arbitrary characters (#5867) Changed paths: M reference/filter/constants.validation.xml Diff: diff --git a/reference/filter/constants.validation.xml b/reference/filter/constants.validation.xml index f4cc066c8629..872d0218350f 100644 --- a/reference/filter/constants.validation.xml +++ b/reference/filter/constants.validation.xml @@ -430,6 +430,40 @@ string(18) "gopher://127.0.0.1" </listitem> </varlistentry> </variablelist> + <warning> + <simpara> + This filter is very permissive. As specified in + <link xlink:href="&url.rfc;2181">RFC 2181</link>, a valid domain name is + a string with a maximum length of 253 characters (254 if including a + trailing <literal>.</literal> separator) and where each label (separated + by a <literal>.</literal>) is at most 63 characters. Unless + <constant>FILTER_FLAG_HOSTNAME</constant> is used to ensure that the + domain is also a valid host name, whitespace, metacharacters, control + bytes, and even NUL bytes are accepted by the filter. + </simpara> + <informalexample> + <programlisting role="php"> +<![CDATA[ +<?php + +var_dump(filter_var("!@#$%^&*(){}[]/?=+\|`~\"'<>,", FILTER_VALIDATE_DOMAIN)); +var_dump(filter_var("null byte: >\0<", FILTER_VALIDATE_DOMAIN)); +var_dump(filter_var("space:> <, tab:>\t<, newline: >\n<, carriage return>\r<", FILTER_VALIDATE_DOMAIN)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +string(27) "!@#$%^&*(){}[]/?=+\|`~"'<>," +string(14) "null byte: ><" +string(52) "space:> <, tab:> <, newline: > +<, carriage return> +<" +]]> + </screen> + </informalexample> + </warning> </listitem> </varlistentry> <varlistentry xml:id="constant.filter-validate-email">

« previous php.doc.cvs (#23786) next »