Correctly reset php error handler even when user-code raises an exception