Bug->Req #80116 [Opn]: filter_var rejects scoped IPv6 literal addresses
| From: | cmb@php.net | Date: | Thu, 05 Aug 2021 17:31:35 +0000 |
| Subject: | Bug->Req #80116 [Opn]: filter_var rejects scoped IPv6 literal addresses | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235621@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80116&edit=1
ID: 80116
Updated by: cmb@php.net
Reported by: kieran at supportpal dot com
Summary: filter_var rejects scoped IPv6 literal addresses
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Filter related
Operating System: Linux
PHP Version: 8.0.0beta3
Block user comment: N
Private report: N
New Comment:
> Perhaps a feature request for RFC 4007 support instead of a bug.
Right. And maybe this should only be enabled via a new flag.
Previous Comments:
------------------------------------------------------------------------
[2020-09-17 11:15:31] kieran at supportpal dot com
Perhaps a feature request for RFC 4007 support instead of a bug.
inet_pton also fails with the address mentioned in the example.
------------------------------------------------------------------------
[2020-09-17 10:43:39] kieran at supportpal dot com
Description:
------------
filter_var rejects IPv6 scoped literal addresses. Scoped literal addresses are described at https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses_(with_zone_index)
[RFC 4007](https://tools.ietf.org/html/rfc4007):
a common notation to specify the scope zone, an implementation SHOULD
support the following format:
<address>%<zone_id>
where
<address> is a literal IPv6 address,
<zone_id> is a string identifying the zone of the address, and
`%' is a delimiter character to distinguish between <address> and
<zone_id>.
Test script:
---------------
https://3v4l.org/Lqnm0
<?php
$ip = "fe80::3549:8417:2ad0:ef6a%4";
var_dump(filter_var($ip, FILTER_VALIDATE_IP));
Expected result:
----------------
return true
Actual result:
--------------
return false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80116&edit=1