Req #54629 [Opn->Dup]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
| From: | cmb@php.net | Date: | Sun, 01 Mar 2020 23:02:07 +0000 |
| Subject: | Req #54629 [Opn->Dup]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225826@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54629&edit=1
ID: 54629
Updated by: cmb@php.net
Reported by: xmilky+php at gmail dot com
Summary: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: URL related
Operating System: amd64 GNU/Linux 2.6.35
PHP Version: 5.3.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Closing as duplicate of feature request #68039.
Previous Comments:
------------------------------------------------------------------------
[2016-01-30 20:48:20] narf at devilix dot net
This has been resolved via https://bugs.php.net/bug.php?id=68039
But only for PHP 7
------------------------------------------------------------------------
[2011-05-07 21:26:55] dtajchreber@php.net
The following patch has been added/updated:
Patch Name: trunk
Revision: 1304796415
URL: http://bugs.php.net/patch-display.php?bug=54629&patch=trunk&revision=1304796415
------------------------------------------------------------------------
[2011-05-07 21:26:32] dtajchreber@php.net
The following patch has been added/updated:
Patch Name: 5_3
Revision: 1304796392
URL: http://bugs.php.net/patch-display.php?bug=54629&patch=5_3&revision=1304796392
------------------------------------------------------------------------
[2011-04-29 04:13:36] dtajchreber@php.net
"Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396), optionally with
required components. Note that the function will only find ASCII URLs to be
valid; internationalized domain names (containing non-ASCII characters) will fail."
RFC 2396 doesn't support IPv6 addresses... would need to implement RFC 2732 checks... flipping
to feature request.
[1] http://www.php.net/manual/en/filter.filters.validate.php
[2] http://www.faqs.org/rfcs/rfc2396.html
[3] http://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Refinement_of_specifications
[4] http://tools.ietf.org/html/rfc2732
------------------------------------------------------------------------
[2011-04-29 02:17:43] xmilky+php at gmail dot com
Description:
------------
I just came to wonder why the filter extension rejects my IPv6 URLs. For example this returns
false even though it's a valid HTTP url:
filter_var("http://[::1]:2000/push/thingy",
FILTER_VALIDATE_URL);
I'm somewhat certain that FILTER_VALIDATE_URL actually used
[parse_url](http://php.net/parse_url) behind the scenes to probe for URL correctness.
But parse_url itself works perfectly fine on such addresses:
Array(
[scheme] => http
[host] => [::1]
[port] => 2000
[path] => /push/thingy
So there is some limitation in the filter_var wrapper for _VALIDATE_URL.
---
Note that this is a distinct issue to http://bugs.php.net/bug.php?id=48762&edit=2
which was about FILTER_VALIDATE_IP addresses only.
Test script:
---------------
<?php
var_dump(filter_var("http://[::1]/path?qs",
FILTER_VALIDATE_URL));
?>
Expected result:
----------------
string(20) "http://[::1]/path?qs"
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54629&edit=1