|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34775 parse_url() provide better error description on failure
Submitted: 2005-10-07 08:35 UTC Modified: 2018-02-11 17:55 UTC
From: Assigned:
Status: Open Package: URL related
PHP Version: * OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-10-07 08:35 UTC]
parse_url() may return FALSE if the url cannot be parsed but doesn't indicate why it failed.

parse_url() internally calls php_url_parse_ex() which, from a quick look, has currently two cases it returns NULL (and thus parse_url() returns FALSE):

if (e-p > 5) { /* port cannot be longer then 5 characters */
return NULL

/* check if we have a valid host, if we don't reject the string as url */
return NULL;

An error code or string should be available for functions calling php_url_parse_ex() so a message to the user can be forwarded why it failed.

ps: the captcha is really really very unfriendly. This is my fifth try because all the time some of the character aren't even completely visible [cropped off] :-[


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:47 UTC]
-Package: Feature/Change Request +Package: *General Issues -Operating System: Any +Operating System: * -PHP Version: 6CVS-2005-10-07 (CVS) +PHP Version: *
 [2018-02-11 17:55 UTC]
-Package: *General Issues +Package: URL related
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC