php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80116 filter_var rejects scoped IPv6 literal addresses
Submitted: 2020-09-17 10:43 UTC Modified: -
From: kieran at supportpal dot com Assigned:
Status: Open Package: Filter related
PHP Version: 8.0.0beta3 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-09-17 10:43 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-17 11:15 UTC] 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.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Oct 27 12:01:22 2020 UTC