|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77217 FILTER_FLAG_NO_RES_RANGE means Reserved-By-Protocol
Submitted: 2018-11-29 02:25 UTC Modified: 2018-11-29 19:41 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dan dot franklin at fen dot com Assigned:
Status: Open Package: Filter related
PHP Version: 7.1.24 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dan dot franklin at fen dot com
New email:
PHP Version: OS:


 [2018-11-29 02:25 UTC] dan dot franklin at fen dot com
According to the IPv4 address range is reserved for carrier-grade NAT.  But in PHP 7.1.24 filter_var with FILTER_FLAG_NO_RES_RANGE thinks it's fine.

Test script:
var_export(filter_var('', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-29 02:41 UTC]
-Summary: FILTER_FLAG_NO_RES_RANGE should match +Summary: FILTER_FLAG_NO_RES_RANGE means Reserved-By-Protocol -Type: Bug +Type: Documentation Problem -Package: Unknown/Other Function +Package: Filter related
 [2018-11-29 02:41 UTC]
FILTER_FLAG_NO_RES_RANGE refers specifically to ranges marked as Reserved-By-Protocol in RFC 6890, which covers the addresses mentioned in the documentation. What Wikipedia labels as "reserved" is really more about the range having a special meaning.

If anything, 100./10 would be part of the the PRIV_RANGE, except the range isn't entirely private. Debatable.
 [2018-11-29 14:34 UTC] dan dot franklin at fen dot com
Thanks for the explanation.  Unfortunately this means that the two current IP validation flags don't meet my needs.  Seems like there needs to be a new flag FILTER_FLAG_GLOBAL_RANGE which rejects IP addresses that are marked as "Global: false" in RFC 6890 (amended to "Global Reach" in RFC 8190).
 [2018-11-29 17:07 UTC]
> Seems like there needs to be a new flag FILTER_FLAG_GLOBAL_RANGE
Sounds reasonable. Please create a feature request for it so this bug report can be about fixing the documentation for FILTER_FLAG_NO_RES_RANGE.

Though maybe it should be "FILTER_FLAG_NO_GLOBAL_RANGE".
 [2018-11-29 19:41 UTC] dan dot franklin at fen dot com
Thanks, I've submitted a feature request.

I would expect a flag NO_GLOBAL_RANGE to _exclude_ global addresses, as NO_RES_RANGE excludes reserved addresses and NO_PRIV_RANGE excludes private addresses.  I suggested FILTER_FLAG_ONLY_GLOBAL_RANGE in my feature request.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue May 11 08:01:24 2021 UTC