|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
26 - 20 = ?
Subscribe to this entry?

 [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: Wed May 05 22:01:34 2021 UTC