Feature Request #4537

Add shutdown handler

Added by Z Binzl over 2 years ago. Updated about 2 years ago.

Status:NewStart date:06/03/2012
Priority:NormalDue date:
Assignee:-% Done:


Target version:-
Resolution: Points:1


Currently Minion registers its own exception handler but still relies on Kohana::shutdown_handler for catching E_PARSE, E_ERROR, E_USER_ERROR. This calls Kohana_Exception::handler, and so displays html output in the console. Quite fiddly for parse errors especially.

A current inadequate hack is to call this before Kohana::init in Minion bootstrap:

register_shutdown_function(function() {
    if ($error = error_get_last() AND in_array($error['type'], array(E_PARSE, E_ERROR, E_USER_ERROR)))

A proper handler added to Minion would be nice. :)

Related issues

Related to Kohana v3.x - Bug Report #4627: shutdown_handler always uses 'Kohana_Exception::handler' ... Closed 10/24/2012


#1 Updated by Sam Wilson about 2 years ago

Yes, this has been frustrating me too!

It could use Kohana::$shutdown_errors couldn't it? As in:

    if (Kohana::$errors AND $error = error_get_last() AND in_array($error['type'], Kohana::$shutdown_errors))

I guess a module can't do this though, because the main shutdown function will be registered first, and contains exit(1)?

How should this be fixed?

#2 Updated by Sam Wilson about 2 years ago

There's also #4627, that will make it possible for Minion to do this properly.

Also available in: Atom PDF