View Issue Details

IDProjectCategoryView StatusLast Update
0028963mantisbtadministrationpublic2023-10-31 16:32
Reporterdregad Assigned Todregad  
Status closedResolutionfixed 
Target Version2.26.0Fixed in Version2.26.0 
Summary0028963: Do not buffer output for CLI scripts

When including MantisBT Core for a command-line tool, the output is delayed until the buffer is full, or the script terminates.

To avoid this behavior, CLI script must end output buffering, twice

include 'core.php';
echo 'foo'; // not displayed
ob_end_flush(); ob_end_flush();  // prints 'foo'

There are indeed 2 calls to ob_start():

  • core.php line 90. This was introduced in 0008761, apparently to avoid Content Encoding errors - not sure if this is still an issue today.
  • compress_api.php in compress_start_handler() function

It's additionally worth noting that the ini_set( 'zlib.output_compression', true ); call in compress_handler_is_enabled() function, effectively also starts output buffering.

TagsNo tags attached.


related to 0008761 closedgrangeway compress_handler called before defined 
related to 0020865 closeddregad 'Content Encoding Error' when errors occur before compress handler is started 


There are no notes attached to this issue.

Related Changesets

MantisBT: master 8530e72e

2021-08-07 04:28


Details Diff
Don't start output buffering or compression for CLI

Fixes 0028963
Affected Issues
mod - core.php Diff File
mod - core/compress_api.php Diff File