How to overload shutdown function?
Posted
by
Michal M
on Stack Overflow
See other posts from Stack Overflow
or by Michal M
Published on 2011-01-09T15:29:34Z
Indexed on
2011/01/11
6:53 UTC
Read the original article
Hit count: 209
I am using Kohana (v3) framework but I believe it's not tied to a particular framework.
What I have is basically an app with a front-end, where I want to use Kohana's native Kohana::shutdown_handler()
, but I also have a part of the - RESTful API - where I don't want colourful and html-encoded exception reporting. I want a plain text reporting.
The way I thought it might work is to register another shutdown function in API's controller abstract class constructor, but then I realised register_shutdown_function()
works differently to set_exception_handler()
and instead of replacing it adds another function to the shutdown procedure. What's worse PHP doesn't allow "unregistering" shutdown functions and that's where my problem lies.
What to do, if you want to use another shutdown function instead of one already registered?
© Stack Overflow or respective owner