Support

Home Forums Event Espresso Premium PHP Error when downloading CSV files

PHP Error when downloading CSV files

Posted: February 3, 2015 at 4:45 am


Bruce

February 3, 2015 at 4:45 am

When clicking ‘export’ from an event to download the csv files, I’m getting a runtime error:
Warning: Cannot modify header information – headers already sent by (output started at /home/beespoke/public_html/wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_CSV.class.php:588) in /home/beespoke/public_html/wp-content/plugins/event-espresso-core-reg/core/db_classes/EE_CSV.class.php on line 593

Line 593-596 is:
header(“Pragma: public”);
header(“Expires: 0”);
header(“Pragma: no-cache”);
header(“Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0”);

Line 588 (Where the output started) is in the same function and is the @ob_flush() call. (Code below). Can someone on the support team please let me know how to fix this issue.

Many thanks,
Bruce.

//if somebody’s been naughty and already started outputting stuff, trash it
//and start writing our stuff.
if (ob_get_length()) {
@ob_flush();
@flush();
@ob_end_flush();
}


Dean

February 3, 2015 at 5:36 am

Hi Bruce,

What (exact) version of EE are you using? Have you updated EE or any other plugins recently? Have you tried disabling all other plugins to see if the issue persists?


Bruce

February 3, 2015 at 9:09 am

we are using Version 4.4.7.p

nothing has changed recently, but this could be the first time someone has tried to download an export csv file.

I’ve disabled all non-essential plugin’s but as the website is live, I can’t disable them all. However, since the error is happening within the same function, I doubt the reason is because of another plugin. Something is being emitted inside the @ob_flush() function, whatever that is.

Many thanks,

Bruce.


Josh

  • Support Staff

February 3, 2015 at 9:20 am

Hi Bruce,

I can advise cloning your live site onto a dev server, then deactivate all of the plugins except for Event Espresso, and switch the live site to use the twenty fifteen theme.

This will allow you to troubleshoot the error you’re seeing without messing with the live site.


Bruce

February 3, 2015 at 12:14 pm

So after playing around with a copy of the site, it looks like its coming from the custom functions.php of our child theme of avada, which is the theme that we are using.
The error is now saying that output is happening on Line 1 of the functions.php file of our child-theme but I can’t see anything that is being written here.
“<?php” is the very first thing in the file, and then it just has our custom shortcodes in it.

Any ideas where what to try next?


Josh

  • Support Staff

February 3, 2015 at 12:36 pm

Hi Bruce,

Here is a link to the WordPress codex that has step by step instructions you can follow to troubleshoot and fix the functions.php file:

http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F


Bruce

February 3, 2015 at 1:02 pm

Thanks Josh.

Found a hidden non-printing character in the file. Getting rid of that cleared up the issue.

Many thanks.
Bruce,


Josh

  • Support Staff

February 3, 2015 at 1:04 pm

You’re welcome Bruce.

The support post ‘PHP Error when downloading CSV files’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso