Bug #73047 [Csd]: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC 5156

From: Date: Thu, 05 Aug 2021 17:07:24 +0000
Subject: Bug #73047 [Csd]: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC 5156
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235620@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 Updated by: cmb@php.net Reported by: cmb@php.net Summary: FILTER_FLAG_NO_RES_RANGE implements obsoleted RFC 5156 Status: Closed Type: Bug Package: Filter related Operating System: * PHP Version: 7.1Git-2016-09-08 (Git) Assigned To: cmb Block user comment: N Private report: N New Comment: This has been fixed in the meantime. Previous Comments: ------------------------------------------------------------------------ [2021-08-05 17:07:24] cmb@php.net This has been fixed in the meantime. ------------------------------------------------------------------------ [2017-10-30 14:27:02] sniper at nerdsluts dot net 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::" ------------------------------------------------------------------------ [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

« previous php.bugs (#235620) next »