On CiviCRM 4.7.7 Error Exporting
This is a bug in CiviCRM. I can replicate the issue on my database using v4.7.

Basically what is happening is that if a sort order isn't defined, the $order variable is NULL which throws off the strpos() function and sends the error message which then triggers the "headers already sent" errors.

See this post about why the $order variable was changed: https://forum.civicrm.org/index.php?topic=36040.0

This post &quot;Empty needle&quot; error when exporting from Advanced Search results provides a quick fix by hiding error messages.

I've submitted an issue to CiviCRM: https://issues.civicrm.org/jira/browse/CRM-19212