Bug #54629 [NEW]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/

From: Date: Fri, 29 Apr 2011 00:17:44 +0000
Subject: Bug #54629 [NEW]: FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160433@lists.php.net to get a copy of this message
From:             
Operating system: amd64 GNU/Linux 2.6.35
PHP version:      5.3.6
Package:          URL related
Bug Type:         Bug
Bug description:FILTER_VALIDATE_URL rejects IPv6 URLs http://[::1]/

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 bug report at http://bugs.php.net/bug.php?id=54629&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=54629&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=54629&r=trysnapshot53
Try a snapshot (trunk):              http://bugs.php.net/fix.php?id=54629&r=trysnapshottrunk
Fixed in SVN:                        http://bugs.php.net/fix.php?id=54629&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54629&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=54629&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=54629&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=54629&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=54629&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=54629&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=54629&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=54629&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=54629&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=54629&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54629&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54629&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=54629&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=54629&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=54629&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=54629&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=54629&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#160433) next »