Merging changes from https://github.com/druu/PHP-Error to add clear_all_buffers option