This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » header expires: 0 causing critical error
expandshrink

header expires: 0 causing critical error

header expires: 0 causing critical error

Monday 28 October 2013 4:31:27 pm - 2 replies

Hello.

I'm running a 5.1 installation with the following legacycode for an export to excel:

header("Content-Type: application/vnd.ms-excel"blunk.gif Emoticon;
header("Content-Disposition: attachment; filename=event.xls"blunk.gif Emoticon;
header("Pragma: no-cache"blunk.gif Emoticon;
header("Expires: 0"blunk.gif Emoticon;

This code was working in 4.7 but in 5.1 it generates the following error in ezpublish/logs/prod.log:

request.CRITICAL: Uncaught PHP Exception Exception: "DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character" at /storage/kunder/vianova.se/www/ezpublish-5.1.0/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishLegacyBundle/Controller/LegacyKernelController.php line 123 [] []

and causes the page to go blank (of course).

If i comment out header("Expires: 0"blunk.gif Emoticon; it works but the file is downloaded as "event.xls, attachment" insted of "event.xls".

Anyone eager to point me in the right direction? How should i define my header?

- Harald

Monday 28 October 2013 5:17:38 pm

Hi Harald

try setting the Expiry Header to a valid date in the past (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).

Hope this helps.

Regards, Donat

Tuesday 29 October 2013 10:10:53 am

Thanks, Donat!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from