|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43411 parse_url with relative URLs contained http:// in parameters
Submitted: 2007-11-26 12:34 UTC Modified: 2007-11-26 12:49 UTC
From: php at koterov dot ru Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.5 OS:
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: php at koterov dot ru
New email:
PHP Version: OS:


 [2007-11-26 12:34 UTC] php at koterov dot ru
When I pass a relative URL to parse_url and it contains something like "http://xxx" in QUERY_STRING parameters, parse_url reports that the URL is broken.

So it is not always safe to call 

I think the solution should be: if an URL is relative (started with '/'), do not report a warning when its arguments contain ":".

Possibly you will say "won't fix" and "URL is not RFC-complaint", but this argument is not relevant when I call parse_url($_SERVER['REQUEST_URI']) (it may be hand-made and non-RFC complaint).

Reproduce code:

Expected result:

Actual result:
Warning: parse_url(/test/?retpath=http://xxx): Unable to parse URL


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-26 12:49 UTC]
There is quite clear note in manual for parse_url(): "Note: This function doesn't work with relative URLs."
 [2013-05-15 18:45 UTC] alias dot mac at gmail dot com

It is working on 5.3.20.


$x = '


$y = '/path/to/somewhere?

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 08:01:31 2024 UTC