Req #50563 [Asn]: removing E_WARNING from parse_url()
| From: | kalle@php.net | Date: | Mon, 24 May 2010 13:18:54 +0000 |
| Subject: | Req #50563 [Asn]: removing E_WARNING from parse_url() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150766@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=50563&edit=1
ID: 50563
Updated by: kalle@php.net
Reported by: philip@php.net
Summary: removing E_WARNING from parse_url()
Status: Assigned
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: N/A
PHP Version: 5.3.2RC1
Assigned To: derick
New Comment:
I did a quick and dirty patch to turn the $component into a bitfield
allowing you to do:
$url = parse_url('http://www.php.net/manual/', PHP_URL_HOST |
PHP_URL_PATH);
printf('%s%s', $url['host'], $url['path']);
At the same point I figured we could disable the warning and therefore
I added a new constant named PHP_URL_SILENT:
$broken_url = 'http:///www.php.net/';
var_dump(parse_url($broken_url), parse_url($broken_url,
PHP_URL_SILENT));
It doesn't alter the actual URL parser code to tell why the parsing
failed, but it kills two flies in one hit. Ofcourse the silent option
can be skipped, but while atleast updating parse_url().
The patch uploaded here does not currently fix any broken tests.
Theres a minor BC break, since it changes the values of the constants,
but it can be fixed by changing the checking code, or the dirty way to
increase the values so they don't conflict with the old ones.
Previous Comments:
------------------------------------------------------------------------
[2009-12-23 16:57:14] derick@php.net
Actually, it should allow for returning *why* the parsing failed as
well. Assigning to myself.
------------------------------------------------------------------------
[2009-12-23 16:52:58] philip@php.net
Description:
------------
parse_url() does not need to emit an E_WARNING upon failure, as instead
it returns false. Doing both basically requires people to use @.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=50563&edit=1