Req #50563 [Opn]: removing E_WARNING from parse_url()
| From: | philip@php.net | Date: | Mon, 24 May 2010 14:30:58 +0000 |
| Subject: | Req #50563 [Opn]: removing E_WARNING from parse_url() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150770@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: philip@php.net
Reported by: philip@php.net
Summary: removing E_WARNING from parse_url()
Status: Open
Type: Feature/Change Request
Package: *General Issues
Operating System: N/A
PHP Version: 5.3.2RC1
New Comment:
I don't think the bit fields should be used to hide the warning.
Previous Comments:
------------------------------------------------------------------------
[2010-05-24 15:38:58] kalle@php.net
The following patch has been added/updated:
Patch Name: parse-url-bitfields
Revision: 1274708338
URL:
http://bugs.php.net/patch-display.php?bug=50563&patch=parse-url-bitfields&revision=1274708338
------------------------------------------------------------------------
[2010-05-24 15:36:44] pajoye@php.net
Derick, I don't see why you would change the return value here. Please
explain your reasoning.
However the patch to remove the warning can be applied already, as I
explained on internals.
------------------------------------------------------------------------
[2010-05-24 15:18:53] kalle@php.net
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.
------------------------------------------------------------------------
[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