php.net |  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
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dan dot franklin at fen dot com Assigned:
Status: Closed 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
According to https://en.wikipedia.org/wiki/Reserved_IP_addresses the IPv4 address range 100.64.0.0/10 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:
---------------
<?php
var_export(filter_var('100.74.11.184', FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));


Expected result:
----------------
false

Actual result:
--------------
'100.74.11.184'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-29 02:41 UTC] requinix@php.net
-Summary: FILTER_FLAG_NO_RES_RANGE should match 100.64.0.0/10 +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] requinix@php.net
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] requinix@php.net
> 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.
https://bugs.php.net/bug.php?id=77221&thanks=4

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.
 [2021-08-05 17:03 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/3d85246557ce5d38c036c019011f6427e61b7041
Log: Fix #77217: FILTER_FLAG_NO_RES_RANGE means Reserved-By-Protocol
 [2021-08-05 17:03 UTC] git@php.net
-Status: Open +Status: Closed
 [2021-08-06 01:24 UTC] git@php.net
Automatic comment on behalf of mumumu
Revision: https://github.com/php/doc-ja/commit/43a5bc605ccb639c4ff9190f9bd070ff521c066e
Log: Fix #77217: FILTER_FLAG_NO_RES_RANGE means Reserved-By-Protocol
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC