2009/7/24  <u...@domain.invalid>:
> I published a (work in progress) RFC today about replacing certain
> errors with exceptions. I know that there already was something similiar
> on the php6dev blog, but this is not completly the same, so awating your
> comments:
>
> http://wiki.php.net/rfc/errors_as_exceptions
>

I'm a big -1, I don't see a big reason for wrapping all my code in a
try/catch block when im writing flat out procedural for example, PHP
isn't an OO-only language, if you need to catch such errors via
exceptions you can simply do it by having a custom error handler and
the ErrorException as you linked to, like:

set_error_handler(function($severity, $message, $file = NULL, $line =
NULL, $context = NULL)
{
        if(!(error_reporting() & $severity))
        {
                return;
        }

        throw new ErrorException($message, 0, $severity, $file, $line,
$context);
});

I don't know if PHP should adopt code into the core that can be done
in less than 10 lines, however with an ini setting it might work as
long its off by default, but I'm not sure how many others here are
happy about adding another ini setting for this.


ps. Fix your email when posting


-- 
regrads,

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