php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49832 parse_url won't parse properly a.com:::
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
http://a.com::: 
Array ( [scheme] => http [host] => a.com:: )
expected: return false

Reproduce code:
---------------
$url_parts = parse_url("http://a.com:::");
print_r($url_parts); 


Expected result:
----------------
See Description

Actual result:
--------------
See Description

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

Your example URL, "http://a.com:::", 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] => a.com:: )

Expected: return false
 [2009-10-11 09:08 UTC] Sjoerd@php.net
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: Wed Apr 24 00:01:32 2024 UTC