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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
47 - 4 = ?
Subscribe to this entry?

 
 [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: *
 [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: Fri Apr 19 14:01:30 2024 UTC