|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Thank you for your help! If the status of the bug report you submitted changes, you will be notified. You may return here and check the status or update your report at any time.
The URL for your bug report is:
Request #77221 Request IP address filter flag to exclude non-global IP addresses
Submitted: 2018-11-29 19:38 UTC Modified: 2018-11-29 22:47 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: dan dot franklin at fen dot com Assigned:
Status: Open Package: filter (PECL)
PHP Version: Next Minor Version OS: Linux
Private report: No CVE-ID: None
 [2018-11-29 19:38 UTC] dan dot franklin at fen dot com
Currently, filter_var is able to filter out private IP addresses and those reserved by protocol with the FILTER_FLAG_NO_PRIV_RANGE and FILTER_FLAG_NO_RES_RANGE flags respectively.

There is a need for further filtering, to determine whether an IP address is Global, as described in RFC 6890.

Only global addresses are useful in identifying the country of origin; this new filter would enable PHP code to search through the list of addresses in an X-Forwarded-For header to find the first global address and send only that address to a country locator such as GeoIP.

Global addresses would also be useful for forensic purposes.

This request is for a new flag, perhaps called FILTER_FLAG_ONLY_GLOBAL_RANGE, that would filter out all IP address ranges listed as “Global: false” in RFC 6890.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-29 22:47 UTC]
-Package: Network related +Package: filter
 [2018-11-29 22:47 UTC]
Changing package to PECL/filter (“Filter related” is for stream filters).
 [2019-03-24 07:05 UTC] yutafuji2008 at gmail dot com
Hi, I read and came to this page.
I totally agree with what dan dot franklin says and want this flag, too!
Is someone working on this now, or can I make a PR on ?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 09 07:01:23 2021 UTC