From: Christian Hack <christianh@pd...> - 2003-12-10 06:56:24
> When we try and download an attachment, it corrupts it with a CRLF at
> the beginning. Then for some reason it makes the file the
> same size and
> thus drops the last two characters off.
> I appears to affect all files. Even ones ending in suffixes like .bin,
> .scb and .raw. The last two are custom ones for our software.
> It never did this before. So you say what have I changed? The
> only thing
> I have changed recently (that relates to Mantis) is the fix for the
> correct path when sending a reminder. I haven't rebooted the
> thing since
OK I have fixed it myself. What a shocker this was. Somehow when I
manually modified core/email_api.php to fix the reminder link problem
an extra CR/LF ended up at the very end of the file i.e. outside the
<?php ?>. During all the include stages (3 or 4 levels worth) of
file_download.php, this CR/LF was passed through and when the bin file
was downloaded it ended up with the CR/LF at the beginning.
So problem solved but it does sound like a pretty big trap for people.
One blank line outside the <?php ?> seems OK from the previous CR/LF.
However as soon as a CR/LF is outside or at least a non space character,
it ripples through. The extra CR/LF was appearing on every file that had
email_api.php included. With the main PHP/HTML pages and text
attachments, this wasn't a problem. However as soon as a binary file was
served it fell to pieces.
Is there anything that can be done development wise to prevent this from
happening? I have no idea what could possibly prevent this from
occurring. I'm CCing this to the developers list.
Get latest updates about Open Source Projects, Conferences and News.