2010/3/22 Johannes Schlüter <johan...@php.net>

> Hi,
>
> On Mon, 2010-03-22 at 16:00 +0100, Olivier B. wrote:
> > well, maybe we should provide a better behaviour for all fatal errors, no
> ?
> > A frequent one I see is the fatal error for calls like "$obj->method()",
> > when $obj is not an object.
> >
> > Isn't possible to allow catching of fatal errors, like other errors ?
>
> Fatal errors might let the engine in some undefined state. The only safe
> thing we can do is terminate the current script. fror other cases we
> have catchable fatal errors. Maybe there are a few more cases where
> fatal errors can be made catchable fatal errors, but these are case by
> case decisions.
>
> Then why is this snippet working:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

register_shutdown_function(
function (){
echo 111;
}
);

if(ob_get_level()){
ob_end_flush();
}
echo 123;
flush();
$obj->func();
echo 456;

script execution can continue on fatal error.
you can use the register_shutdown_function, or the ob_start function
callback param to continue the execution after an uncatchable fatal error.
I think either this kind of errors should be catchable(except the errors in
the engine itself, not in the userland) or the above mentioned two method
shouldn't be working.

Tyrael

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

Reply via email to