Closed seansan closed 6 years ago
In Zend_Controller_Response_Abstract
you can change canSendHeaders
method to log file and line:
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);
}
// to get PHP's report on which file is sending a header.
if ($ok){
Mage::log('File: ' . $file);
Mage::log('Line: ' . $line);
}
return !$ok;
}
thanks yes we have added debugging (actually on more levels)
But does this not show the same output like some lines higher ('Cannot send headers; headers already sent in ' . $file . ', line ' . $line);
Or is the idea here to get a list of files and once we hit the error, we take the line just before it?
On Mon, Mar 20, 2017 at 12:16 PM, sreichel notifications@github.com wrote:
In Zend_Controller_Response_Abstract you can change canSendHeaders method to log file and line:
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); } // to get PHP's report on which file is sending a header. if ($ok){ Mage::log('File: ' . $file); Mage::log('Line: ' . $line); } return !$ok; }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenMage/magento-lts/issues/246#issuecomment-287732052, or mute the thread https://github.com/notifications/unsubscribe-auth/AAn0a-PFYTEM3FGQhdqfbS4W6w1cjGAhks5rnmAZgaJpZM4MhygJ .
lib/Zend/Controller/Response/Abstract.php: Line: 593
Where the bodyb is outputted ;)
<!doctype html> seems right everywhere
Not really related to LTS.
I have added some more debug statements
can it be smart to add the code to LTS? but escape it?
Below has helped us a lot identifying where it is coming from
` public function canSendHeaders($throw = false)
{
$ok = headers_sent($file, $line);
// to get PHP's report on which file is sending a header.
if ($ok !== false){
Mage::log('File: ' . $file . ' // Line: ' . $line, null, 'httpheaderssent_exception.log', true);
$module = Mage::app()->getRequest()->getModuleName();
$controller = Mage::app()->getRequest()->getControllerName();
$action = Mage::app()->getRequest()->getActionName();
Mage::log('Url: ' . $module . '/' . $controller . '/' . $action, null, 'httpheaderssent_exception.log', true);
$body = implode('', $this->_body);
$body = substr($body, 0, 1000);
Mage::log('Body: ' . $body, null, 'httpheaderssent_exception.log', true);
}
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;
}`
Hi, I was just trying M 1.9.3.x version. Have been running on stable 1.9.3.1. And I must admit we had this debug message before. HEADERS ALREADY SENT - and we did fix it.
Only after the upgrade to 1.9.3.x it is back
Maybe some others have encountered this too? (we have log enabled ;)
If/when I find a fix I will post it
2017-03-19T16:17:07+00:00 DEBUG (7): HEADERS ALREADY SENT: