I am receiving the following error in my system.log file:
2011-01-12T14:16:52+00:00 DEBUG (7): HEADERS ALREADY SENT:
[0] C:\\xampp\\htdocs\\www.mysite.com
That error is thrown from Mage_Core_Controller_Response_Http -> sendHeaders(). This function calls the super class function that actually does the check to see whether or not headers have already been sent, Zend_Controller_Response_Abstract -> canSendHeaders().
The Zend_Controller_Response_Abstract class handles, among other things, sending response headers and tracking the last time the headers were sent (and from what file and line). Here is what that function looks like, and where we'll make a change around line 316 to lib\Zend\Controller\Response\Abstract.php:
public function canSendHeaders($throw = false) {
$ok = headers_sent($file, $line);
if ($ok && $throw && $this->headersSentThrowsException) {
#require_once 'Zend/Controller/Response/Exception.php';
throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
}
return !$ok;
}
To:
public function canSendHeaders($throw = false)
{
$ok = headers_sent($file, $line);
if ($ok) {
Mage::log('Cannot send headers; headers already sent in ' . $file . ', line ' . $line, null, 'headers.log');
}
return !$ok;
#if ($ok && $throw && $this->headersSentThrowsException) {
# #require_once 'Zend/Controller/Response/Exception.php';
# throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
#}
#return !$ok;
}
This will log the error in /var/log/header.log.