Hey Ralph

2010/5/21 Ralph Schindler <ra...@smashlabs.com>:
>
> Hey all,
>
> The first patch is against trunk.  I think we should at least get this done
> even if the group decides that down the line we want the why portion
> explained as well (I actually don't care about the why part). That feature
> would require that php_url_parse_ex() add some parsing intellignce, this
> would not be a 1 or 2 line feature implementation.

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().

Patch available at, this is a rough patch and does not fix the broken tests:
http://pastie.org/974449

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.

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to