ID: 41491
Updated by: [EMAIL PROTECTED]
Reported By: jeff at pointhere dot net
-Status: Open
+Status: Feedback
Bug Type: HTTP related
Operating System: Sun OS 5.10 (Solaris 10)
PHP Version: 5.2.2
New Comment:
Can you try leaving header() calls with static parameters (no embeded
variables) and see if you still get the extra chars?
Previous Comments:
------------------------------------------------------------------------
[2007-05-24 15:50:34] jeff at pointhere dot net
Description:
------------
When using the header() function to prepend a text file so that a user
can save a downloaded file, the resulting file has two extra characters
on the front of the file (hex '200A' - space and line-feed). When
header() functions are removed, the file appears to load into the
browser correctly.
Reproduce code:
---------------
// Start sending the file
ob_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: text/plain");
header("Content-Length: " . $filesize);
header("Content-Disposition: attachment; filename=\"" . $filename .
"\"");
header("Content-Transfer-Encoding: 7bit");
echo($cardprint_file);
ob_end_flush();
exit;
Expected result:
----------------
The user's browser should open a window that asks to Open, Save or
Cancel the download. When saving or opening the file the contents of
$cardprint_file should be the ONLY contents (the contents were verified
to be correct with the var_dump command).
Actual result:
--------------
The first two characters in the file (which translate to a blank line)
are an ASCII hex 20 (space) and an ASCII hex 0A (Line feed).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41491&edit=1