Req #54629 [PATCH]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
| From: | dtajchreber@php.net | Date: | Sat, 07 May 2011 19:26:56 +0000 |
| Subject: | Req #54629 [PATCH]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160599@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54629&edit=1
ID: 54629
Patch added by: dtajchreber@php.net
Reported by: xmilky+php at gmail dot com
Summary: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
Status: Open
Type: Feature/Change Request
Package: URL related
Operating System: amd64 GNU/Linux 2.6.35
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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 http://bugs.php.net/bug.php?id=54629&edit=1