Bug #73047 [Com]: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC 5156
| From: | sniper at nerdsluts dot net | Date: | Mon, 30 Oct 2017 14:27:05 +0000 |
| Subject: | Bug #73047 [Com]: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC 5156 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212379@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73047&edit=1
ID: 73047
Comment by: sniper at nerdsluts dot net
Reported by: cmb@php.net
Summary: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC
5156
Status: Open
Type: Bug
Package: Filter related
Operating System: *
PHP Version: 7.1Git-2016-09-08 (Git)
Block user comment: N
Private report: N
New Comment:
Can add that php does not seem to filter the range 3ffe::/16 from the same RFC, which it of course
shouldn't, but it might explain why it does filter 3ff3::/16 if done by mistake as I've
not managed to find any reason why it should be filtered.
Looking back at the git history:
https://github.com/php/php-src/commit/e90265ac978a5d92beb7c37ecf3107c2c5f1d7f5
And the bug report:
https://bugs.php.net/bug.php?id=47435
This seems to be the case.
Test script:
---------------
<?php
var_dump(filter_var('3ff3::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var('3ff3::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 |
FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var('5f00::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var('5f00::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 |
FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var('3ffe::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var('3ffe::', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 |
FILTER_FLAG_NO_RES_RANGE));
Expected result:
---------------
string(6) "3ff3::"
string(6) "3ff3::"
string(6) "5f00::"
string(6) "5f00::"
string(6) "3ffe::"
string(6) "3ffe::"
Actual Result:
---------------
string(6) "3ff3::"
bool(false)
string(6) "5f00::"
bool(false)
string(6) "3ffe::"
string(6) "3ffe::"
Previous Comments:
------------------------------------------------------------------------
[2016-09-08 11:54:44] cmb@php.net
Description:
------------
FILTER_FLAG_NO_RES_RANGE still implements the obsoleted RFC
5156[1] for IPv6 addresses, instead of the current RFC 6890[2].
[1] <https://tools.ietf.org/html/rfc5156>
[2] <https://tools.ietf.org/html/rfc6890>
Test script:
---------------
<?php
var_dump(filter_var('5f00:0:0:0:0:0:0:0', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6));
var_dump(filter_var('5f00:0:0:0:0:0:0:0', FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 |
FILTER_FLAG_NO_RES_RANGE));
Expected result:
----------------
string(18) "5f00:0:0:0:0:0:0:0"
string(18) "5f00:0:0:0:0:0:0:0"
Actual result:
--------------
string(18) "5f00:0:0:0:0:0:0:0"
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73047&edit=1