Throw an Exception when the header is already been sent

Please see the details of the discussion at  issue #3990
Please help. I don't know what I am supposed to do? do I need to create a new pull request if Travis fails?