|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2009-12-23 16:52 UTC] 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 @. Patchesparse-url-bitfields (last revision 2010-05-24 13:38 UTC by kalle@php.net)fix-parse_url-warning-against-5_3 (last revision 2010-05-21 16:10 UTC by ralph at smashlabs dot com) fix-parse_url-warning-against-trunk (last revision 2010-05-21 16:10 UTC by ralph at smashlabs dot com) Pull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 07:00:02 2025 UTC | 
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.