[doc-en] master: `FILTER_VALIDATE_URL`: document acceptance of loopback addresses

From: Date: Sun, 20 Sep 2026 21:49:54 +0000
Subject: [doc-en] master: `FILTER_VALIDATE_URL`: document acceptance of loopback addresses
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23763@lists.php.net to get a copy of this message
Author: Daniel Scherzer (DanielEScherzer) Date: 2026-09-20T14:44:34-07:00 Commit: https://github.com/php/doc-en/commit/50c9f3e8e25439475fbad952e60334178a54b048 Raw diff: https://github.com/php/doc-en/commit/50c9f3e8e25439475fbad952e60334178a54b048.diff FILTER_VALIDATE_URL: document acceptance of loopback addresses Changed paths: M entities/entities.url.ent M reference/filter/constants.xml Diff: diff --git a/entities/entities.url.ent b/entities/entities.url.ent index b15248b96451..083ec8c80516 100644 --- a/entities/entities.url.ent +++ b/entities/entities.url.ent @@ -134,6 +134,7 @@ URLs, other addresses and external references. <entity name="url.fann.lib">http://leenissen.dk/fann/wp/</entity> <entity name="url.fbsql">http://www.frontbase.com/</entity> <entity name="url.fbsql.docs">http://www.frontbase.com/cgi-bin/WebObjects/FBWebSite.woa</entity> +<entity name="url.filter.loopback">https://en.wikipedia.org/wiki/Loopback</entity> <entity name="url.firebird">http://www.firebirdsql.org/</entity> <entity name="url.flex">http://www.gnu.org/software/flex/flex.html</entity> <entity name="url.floating.point.guide">http://floating-point-gui.de/</entity> diff --git a/reference/filter/constants.xml b/reference/filter/constants.xml index 6791e52d2b3b..d56f118b1975 100644 --- a/reference/filter/constants.xml +++ b/reference/filter/constants.xml @@ -623,7 +623,9 @@ <literal>mailto:</literal>, <literal>news:</literal>, or <literal>file:</literal>. Schemes are not themselves validated and may be accepted despite not corresponding to a known URL scheme, or having some - other meaning in PHP (like <link linkend="book.phar">phar://</link>). + other meaning in PHP (like <link linkend="book.phar">phar://</link>). The + filter also accepts <link xlink:href="&url.filter.loopback;">loopback</link> + addresses that correspond to the current host. </simpara> <informalexample> <programlisting role="php"> @@ -636,6 +638,8 @@ var_dump(filter_var('news:?demo', FILTER_VALIDATE_URL)); var_dump(filter_var('phar://demo', FILTER_VALIDATE_URL)); var_dump(filter_var('123://demo', FILTER_VALIDATE_URL)); var_dump(filter_var('-://demo', FILTER_VALIDATE_URL)); +var_dump(filter_var('http://127.0.0.1', FILTER_VALIDATE_URL)); +var_dump(filter_var('gopher://127.0.0.1', FILTER_VALIDATE_URL)); ?> ]]> </programlisting> @@ -648,6 +652,8 @@ string(10) "news:?demo" string(11) "phar://demo" string(10) "123://demo" string(8) "-://demo" +string(16) "http://127.0.0.1" +string(18) "gopher://127.0.0.1" ]]> </screen> </informalexample>

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