View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011101 | mantisbt | attachments | public | 2009-10-31 00:45 | 2010-02-22 14:34 |
Reporter | joshribakoff | Assigned To | dhx | ||
Priority | high | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.0rc2 | ||||
Target Version | 1.2.0 | Fixed in Version | 1.2.0 | ||
Summary | 0011101: Headers are sent too late in file_download.php (after content has been written) | ||||
Description | In firefox, I am unable to view attachments. It looks like the file is trying to be displayed as plaintext, I get a few pages of "binary" data, followed by an error: <p style="color:red">SYSTEM WARNING: Cannot modify header information - headers already sent by (output started at /home/ins09/public_html/tools/mantisbt/file_download.php:172)</p> If I right click and save link as, I can view the photo. However I attempt to edit my saved .jpg in EditPlus, I can see the PHP error message at the end still. I further narrowed down the problem to your if( $finfo_available). There should be some action taken if the finfo is not available, like prompt the user to download the file, or inform them to enable the finfo extension. | ||||
Steps To Reproduce | Disable finfo extension and try to view a jpeg attachment in firefox. | ||||
Additional Information | My temporary fix was to hard code a content-type header in and 'else', as well as commenting out the Content-Length line ( to fix the headers after output). I suppose I could install finfo also. Attached is the Waterfall.jpg with the error message as plain text inside of the file. Open inside of notepad or EditPlus and scroll to the end of the file. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Is this a duplicate of 0011045? |
|
I would say part of it may duplicate that issue, but the "output already started" error is new. |
|
echo $v_content; This is lines 172- 174, I commented out the last line. Before that was causing the error. |
|
I don't think the checked-in code has the problem you are referring to. If you try your attachment on this bug tracker, it works fine. |
|
See note 0011202:0024010. I am running Mantis on Windows Server 2003 with MySQL. |
|
I corrected this issue by applying the change noted in 0011101:0023509. |
|
Already fixed as part of http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=b341ca89c83b9d906b229d289c35dfcc1185b034 and http://git.mantisbt.org/?p=mantisbt.git;a=commitdiff;h=be57bb8c86e716c6f13c676a0724b7a6338b9e5f I didn't see this bug when I fixed those issues, which is why they weren't linked to this bug earlier. |
|
MantisBT: master-1.2.x ff2d2ab8 2009-10-27 05:24 Details Diff |
Send headers before output buffer is flushed for file_download.php Content-* headers and etc should be sent before the output buffer is flushed at the start of file transfers. These headers have also been reordered so they're grouped together more logically. Also inline_file_exts can now be blank without the 'gif' attachment being forcefully added by Mantis. |
Affected Issues 0011101 |
|
mod - file_download.php | Diff File | ||
MantisBT: master b341ca89 2009-10-27 05:24 Details Diff |
Send headers before output buffer is flushed for file_download.php Content-* headers and etc should be sent before the output buffer is flushed at the start of file transfers. These headers have also been reordered so they're grouped together more logically. Also inline_file_exts can now be blank without the 'gif' attachment being forcefully added by Mantis. |
Affected Issues 0011101 |
|
mod - file_download.php | Diff File | ||
MantisBT: master-1.2.x f06ecd68 2009-10-28 19:06 Details Diff |
ob_end_clean should be called BEFORE headers are sent Follow-up to commit b341ca89c83b9d906b229d289c35dfcc1185b034 ob_end_clean throws away the output buffer instead of flushing it to the client. Therefore we should call this BEFORE the file download headers are sent to the client or else these headers could potentially be thrown away/lost. Note to self: don't rely upon incorrect comments in the code that tell you ob_end_clean flushes the buffer... look it up in the PHP manual! |
Affected Issues 0011101 |
|
mod - file_download.php | Diff File | ||
MantisBT: master be57bb8c 2009-10-28 19:06 Details Diff |
ob_end_clean should be called BEFORE headers are sent Follow-up to commit b341ca89c83b9d906b229d289c35dfcc1185b034 ob_end_clean throws away the output buffer instead of flushing it to the client. Therefore we should call this BEFORE the file download headers are sent to the client or else these headers could potentially be thrown away/lost. Note to self: don't rely upon incorrect comments in the code that tell you ob_end_clean flushes the buffer... look it up in the PHP manual! |
Affected Issues 0011101 |
|
mod - file_download.php | Diff File |