Bug with headers() + flush()
Posted: September 14th, 2017, 8:41 pm
flush() is resetting the HTTP headers()
Sample code:
Expected result: headers should be sent.
Actual result: no headers are sent when calling flush().
Sample code:
- Code: Select all
<?php
header('Content-Transfer-Encoding: binary');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename=test.xls');
header('Pragma: no-cache');
header('Expires: 0');
echo "Content\n";
flush();
die('ok');
Expected result: headers should be sent.
Actual result: no headers are sent when calling flush().