|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49832 parse_url won't parse properly
Submitted: 2009-10-10 15:48 UTC Modified: 2009-10-11 09:08 UTC
From: marius dot andreiana at gmail dot com Assigned:
Status: Not a bug Package: URL related
PHP Version: 5.2.11 OS: Linux
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: marius dot andreiana at gmail dot com
New email:
PHP Version: OS:


 [2009-10-10 15:48 UTC] marius dot andreiana at gmail dot com
Array ( [scheme] => http [host] => )
expected: return false

Reproduce code:
$url_parts = parse_url("");

Expected result:
See Description

Actual result:
See Description


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-10 18:06 UTC]
Thank you for your bug report.

Your example URL, "", does not seem valid to me. Why do you think this URL is valid?
 [2009-10-10 18:44 UTC] marius dot andreiana at gmail dot com
Indeed it's not valid.
Therefore parse_url should return false, this is the bug.

Now returns: Array ( [scheme] => http [host] => )

Expected: return false
 [2009-10-11 09:08 UTC]
I don't think this is a bug.

From the documentation of parse_url:
This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial URLs are also accepted, parse_url() tries its best to parse them correctly. [...] On seriously malformed URLs, parse_url() may return FALSE and emit a E_WARNING.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 20:01:30 2024 UTC