Edit report at https://bugs.php.net/bug.php?id=80116&edit=1
ID: 80116
Comment by: nazi dot farhadi3171 at gmail dot com
Reported by: kieran at supportpal dot com
Summary: filter_var rejects scoped IPv6 literal addresses
Status: Open
Type: Feature/Change Request
Package: Filter related
Operating System: Linux
PHP Version: 8.0.0beta3
Block user comment: N
Private report: N
New Comment:
Works like a charm!
(https://www.arise-portal.com/)github.com
Previous Comments:
------------------------------------------------------------------------
[2021-08-05 17:31:35] cmb@php.net
> Perhaps a feature request for RFC 4007 support instead of a bug.
Right. And maybe this should only be enabled via a new flag.
------------------------------------------------------------------------
[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