|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80116 filter_var rejects scoped IPv6 literal addresses
Submitted: 2020-09-17 10:43 UTC Modified: 2021-08-05 17:31 UTC
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
filter_var rejects IPv6 scoped literal addresses. Scoped literal addresses are described at

[RFC 4007](

a common notation to specify the scope zone, an implementation SHOULD
support the following format:
      <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

Test script:


$ip = "fe80::3549:8417:2ad0:ef6a%4";
var_dump(filter_var($ip, FILTER_VALIDATE_IP));

Expected result:
return true

Actual result:
return false


Add a Patch

Pull Requests

Add a Pull Request


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.
 [2021-08-05 17:31 UTC]
-Type: Bug +Type: Feature/Change Request
 [2021-08-05 17:31 UTC]
> Perhaps a feature request for RFC 4007 support instead of a bug.

Right.  And maybe this should only be enabled via a new flag.
 [2022-12-21 09:27 UTC] nazi dot farhadi3171 at gmail dot com
Works like a charm!
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 11:01:24 2023 UTC