ccampbell/chromelogger

Issue with headers (PHP);

MrDanteBlack opened this issue · 2 comments

If i write ... include(...) and console-write commands NOT in the begining of file, i'll get an Error: "headers already sent";
Which is not cool as I think.
Thank you for your attention.

I've got the same... corrected here (L383)

protected function _writeHeader($data)
{
header(self::HEADER_NAME . ': ' . $this->_encode($data));
}

Replaced with..

protected function _writeHeader($data)
{
if (!headers_sent()) header(self::HEADER_NAME . ': ' . $this->_encode($data));
}

This has been brought up before. It's not a bug in the extension or in the PHP library. You cannot set headers after output has started since the headers have to come first.

Look into using output buffering. See ccampbell/chromephp#15