Edit report at http://bugs.php.net/bug.php?id=54629&edit=1

 ID:                 54629
 Updated by:         dtajchre...@php.net
 Reported by:        xmilky+php at gmail dot com
 Summary:            FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
 Status:             Open
-Type:               Bug
+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:

"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


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to