|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-02-25 16:40 UTC] sbriesen at gmx dot de
$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[:pass]@]host]/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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 01 01:00:01 2025 UTC |
Does this fix also handle file:// paths with driveletters correctely? eg $x=parse_url('file://C:/any/path/file.ext'); I can imagine it breaks over the second : Anyway, I've seen applications that sent this as a referrer in GET requests (Microsoft XML ActiveX control)