|  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: 2021-07-26 18:48 UTC
From: Assigned: cmb (profile)
Status: Wont fix 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
 [2021-07-26 12:55 UTC]
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-07-26 12:55 UTC]
Nothing happened here for more than 15 years, and parse_url() is
broken anyway, so I'm closing this ticket as WONTFIX.
 [2021-07-26 18:48 UTC]
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 13:01:25 2021 UTC