I try to register a shutdown function to log an fatal error. Nice stuff, if it would work for my class…
Inside a method I do this:
register_shutdown_function(array($this, 'handleFatalError'));
handleFatalError is not static, and it’s public:
public function handleFatalErrors() {
if(is_null($e = error_get_last()) === false) {
//mail('your.email@example.com', 'Error from auto_prepend', print_r($e, true));
}
}
PHP says:
Warning: register_shutdown_function()
[function.register-shutdown-function]:
Invalid shutdown callback
‘ErrorManager::handleFatalError’
passed in …
Why’s that an invalid callback?
Because you’re attempting to register ‘handleFatalError’ and the method is called ‘handleFatalErrors’.
Er… that’s it really.