Warning: register_shutdown_function(): Invalid shutdown callback
trait ErrorTrait {
public function shutDownFunction() {
$error = error_get_last();
// fatal error, E_ERROR === 1
if ($error['type'] === E_ERROR) {
//do your stuff
$messageStore="Using $this when not in object context";
if (strstr ( $error['message'],$messageStore))
{
echo "found it";
}
}
}
public function shutdown_function()
{
register_shutdown_function('shutDownFunction');
}
}
I use this trait in my main class and call the functions from it
use ErrorTrait;
public function test()
{ self::shutDownFunction();
self::shutdown_function(); }
And then at this point I call the function in test in a function called "run"
All I do is a simply call the function.
public function run()
{
self::test ();
// Rest of code}
Any ideas as to why this is causing problems?