Req #34775 [Opn->Wfx]: parse_url() provide better error description on failure

From: Date: Mon, 26 Jul 2021 12:55:48 +0000
Subject: Req #34775 [Opn->Wfx]: parse_url() provide better error description on failure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235358@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=34775&edit=1

 ID:                 34775
 Updated by:         cmb@php.net
 Reported by:        mfischer@php.net
 Summary:            parse_url() provide better error description on
                     failure
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            URL related
 Operating System:   *
 PHP Version:        *
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Nothing happened here for more than 15 years, and parse_url() is
broken anyway, so I'm closing this ticket as WONTFIX.


Previous Comments:
------------------------------------------------------------------------
[2005-10-07 08:35:47] 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] :-[



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=34775&edit=1


Thread (3 messages)

« previous php.bugs (#235358) next »