Set $lastError in the exception handler
Exit after calling the exception handler directly in the case of PHP bug 61767 not being fixed