From:             sbriesen at gmx dot de
Operating system: SuSE 8.1
PHP version:      4.3.1
PHP Bug Type:     *URL Functions
Bug description:  parse_url() -> file:// not parsed correctly

$x=parse_url('file:///any/path/file.ext');

gives you:

Array
(
    [scheme] => file
    [host] => /any/path/file.ext
)

$x=parse_url('file://localhost/any/path/file.ext');

gives you:

Array
(
    [scheme] => file
    [host] => localhost
    [path] => /any/path/file.ext
)

the first one is definitively parsed wrong!!! in a file:// url, the 'host'
is optional and is located between :// and the first slash.

scheme://[[user[:[EMAIL PROTECTED]/path

so 

$x=parse_url('file:///any/path/file.ext');

*should* give you:

Array
(
    [scheme] => file
    [path] => /any/path/file.ext
)

and nothing else!

btw: have you ever seen a 'host' with slashes? ;-)

btw^2: a 'join_url' (or similar) should be also available (as the
counterpart to 'parse_url'). Yes, I know, I can write such function for
myself in plain PHP. But there should be always the opposite counterpart
available as a native PHP function!

btw^3: not all file-functions are capable to handle file:// urls
correctly. I know, that is not your problem... ;-) I will try to find all
that functions and create a seperate bugreport.


regards,
Stefan
-- 
Edit bug report at http://bugs.php.net/?id=22423&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22423&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22423&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22423&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22423&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22423&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22423&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22423&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22423&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22423&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22423&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22423&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22423&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22423&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22423&r=gnused

Reply via email to