hmm... okay, then let's try with the easy one: replace the whole block:
// The following logging is just for debug, it should be removed before final
// or at least once the bug is fixes #2391
$filename = '';
$linenum = '';
if (headers_sent($filename, $linenum))
{
if (empty($filename))
{
ob_clean();
}
else
{
Errors::instance()->log_error('Headers already sent in ' . $filename . ' at line ' . $linenum);
}
}
with just:
if (ob_get_level() > 0)
{
@ob_end_clean();
}