php.net |  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: mfischer@php.net Assigned: cmb (profile)
Status: Wont fix Package: URL related
PHP Version: * OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mfischer@php.net
New email:
PHP Version: OS:

 

 [2005-10-07 08:35 UTC] mfischer@php.net
Description:
------------
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):

1) http://cvs.php.net/co.php/php-src/ext/standard/url.c?r=1.88#257
if (e-p > 5) { /* port cannot be longer then 5 characters */
[...]
return NULL

2) http://cvs.php.net/co.php/php-src/ext/standard/url.c?r=1.88#274
/* 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] :-[


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:47 UTC] ajf@php.net
-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] cmb@php.net
-Package: *General Issues +Package: URL related
 [2021-07-26 12:55 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2021-07-26 12:55 UTC] cmb@php.net
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] mfischer@php.net
????
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC