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

Pull Requests

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: Thu Dec 26 15:01:32 2024 UTC