|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20420 parse_url broken on partial URLs
Submitted: 2002-11-14 02:56 UTC Modified: 2002-12-31 12:55 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: pallo-php at initio dot no Assigned: ilia (profile)
Status: Closed Package: URL related
PHP Version: 4.3.0-pre2 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: pallo-php at initio dot no
New email:
PHP Version: OS:


 [2002-11-14 02:56 UTC] pallo-php at initio dot no
In 4.2.x, parsing the partial URL "/foo.php?a=b&c=d"

array(2) {
  string(8) "/foo.php"
  string(7) "a=b&c=d"

but in 4.3.0-pre2 the query part is not recognized an
parse_url() return

array(1) {
  string(16) "/foo.php?a=b&c=d"

The parse_url() function also have problems with URLs like
"file:///foo.txt", where the host is absent, and "mailto:user@domain". Both URLs were handled properly in 4.2.x


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-14 03:13 UTC]
Assinging to Ilia
 [2002-11-14 07:46 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.

 [2002-12-31 02:59 UTC] polone at townnews dot com
As a result of this bug, has the function been changed to now parse file:///path/to/file as:

Array(2) (

   ["scheme"] => 'file'
   ["host"] => '/path/to/file'


That seems incorrect, as it use to:

Array(2) (

   ["scheme"] => 'file'
   ["path"] => '/path/to/file'

Which is correct, and how the function use to behave. If anything, the ["host"] should state "localhost". Needless to say, this should be now documented in the function manual if this is going to be the way it works.
 [2002-12-31 03:00 UTC] polone at townnews dot com
The aforementioned was found in PHP 4.3.0, production, on an RH 6.2 Linux box.
 [2002-12-31 12:17 UTC]
r_1.53 (2 months, 3 weeks ago) which rewrote the php_url_parse function changed the bahavior (from 'path' to 'host')

r_1.61 (25 hours, 32 minutes ago) seems to have completely broken the file:// scheme.  file://path/to/file works (albiet with host and not path) but the technically correct style "file:///path/to/file" fails.

Both issues need to be addressed.
 [2002-12-31 12:55 UTC]
already fixed.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Jan 20 10:03:34 2022 UTC