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: 2015-01-08 23:47 UTC
From: mfischer@php.net Assigned:
Status: Open Package: *General Issues
PHP Version: * OS: *
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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: *
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC