Edit report at http://bugs.php.net/bug.php?id=50563&edit=1

 ID:               50563
 Updated by:       phi...@php.net
 Reported by:      phi...@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] ka...@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] paj...@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] ka...@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] der...@php.net

Actually, it should allow for returning *why* the parsing failed as
well. Assigning to myself.

------------------------------------------------------------------------
[2009-12-23 16:52:58] phi...@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

Reply via email to