Feature Request #4537

Add shutdown handler

Added by Z Binzl almost 2 years ago. Updated about 1 year ago.

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

0%

Category:-
Target version:-
Resolution: Points:1

Description

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)))
        exit(1);
});

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

History

#1 Updated by Sam Wilson about 1 year ago

Yes, this has been frustrating me too!

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

register_shutdown_function(function()
{
    if (Kohana::$errors AND $error = error_get_last() AND in_array($error['type'], Kohana::$shutdown_errors))
    {
        exit(1);
    }
});

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 1 year ago

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

Also available in: Atom PDF