public function shutdownFunction()
    {
        $this->reservedMemory = null;
        
        $err = $this->errorGetLast();
        $unhandled = E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR;
        
        if (empty($err) || !($err['type'] & $unhandled)) {
            return;
        }
        
        $error = new \ErrorException($err['message'], 0, $err['type'], $err['file'], $err['line']);
        
        if ($err['type'] & $this->getLoggedErrorTypes()) {
            $this->log($error);
        }
        
        $this->callOnFatalError($error);
    }