JosephLenton / PHP-Error

Better error reporting for PHP, and prettier too!
1.35k stars 151 forks source link

Support fatal errors #66

Closed slava-vishnyakov closed 11 years ago

slava-vishnyakov commented 11 years ago

Please add support for fatal errors - this can be done via register_shutdown_function and error_get_last http://stackoverflow.com/questions/277224/how-do-i-catch-a-php-fatal-error

Otherwise - great library! Thanks!

Triggering fatal that is not handled by PHP-Error:

$a = array(); while(true) $a []= 'fatal';
panrafal commented 11 years ago

Actually they are supported and work fine for me.Are you sure you've set up everything right?

slava-vishnyakov commented 11 years ago

No, not sure. It worked for most of errors, like fatals and warning. But it failed to catch out-of-memory error. It did catch other fatals though. I've had to stop using PHP-Error though, due to the fact that it outputs a lot of scripts which mess up XML output (scripts are there even if there is no error). Other that that it's a cool lib.

JosephLenton commented 11 years ago

@slava-vishnyakov are you setting the 'content-type' in the header? You should be if you are transferring XML documents (regardless of if you are using PHP Error or not).

If the content type is HTML, XHTML, or there is no type at all, then PHP Error presumes you are outputting a HTML page.

If you are setting a content type, then this is a bug, and I'd be interested in more info.

re fatal errors, they cannot be fully supported at the PHP level. PHP does not allow you to catch every single type of bug, unless you hook into PHP it's self, using a dll (like xdebug does). So for technical reasons, I cannot support them.

slava-vishnyakov commented 11 years ago

@JosephLenton The problem is that - I setup error handling way before the actual controller kicks in, which sets the Content-Type, but by that time - the first output of PHPError is already there. At least that's how I remember it.

JosephLenton commented 11 years ago

Ok, thanks. I will play around with replicating this bug.