|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22423 parse_url() -> file:// not parsed correctly
Submitted: 2003-02-25 16:40 UTC Modified: 2003-02-25 17:38 UTC
From: sbriesen at gmx dot de Assigned:
Status: Closed Package: *URL Functions
PHP Version: 4.3.1 OS: SuSE 8.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sbriesen at gmx dot de
New email:
PHP Version: OS:


 [2003-02-25 16:40 UTC] sbriesen at gmx dot de

gives you:

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


gives you:

    [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.




*should* give you:

    [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.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-25 17:38 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

 [2003-05-01 17:29 UTC] freesoftware at xs4all dot nl
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)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 04 20:03:40 2023 UTC