Magento Headers Already Submitted

I have this problem with headers already submitted with Magento. I get this error:

HEADERS ALREADY SENT: [0] /var/www/etam/trunk/src/app/code/core/Mage/Core/Controller/Response/Http.php:44 [1] /var/www/etam/trunk/src/lib/Zend/Controller/Response/Abstract.php:727 [2] /var/www/etam/trunk/src/app/code/core/Mage/Core/Controller/Response/Http.php:75 [3] /var/www/etam/trunk/src/app/code/core/Mage/Core/Controller/Varien/Front.php:188 [4] /var/www/etam/trunk/src/app/code/core/Mage/Core/Model/App.php:304 [5] /var/www/etam/trunk/src/app/Mage.php:596 [6] /var/www/etam/trunk/src/index.php:139 

I saw this topic, but did not help me much.

I found that I only get this log when I navigate the admin panel and edit the pages using the WYSIWYG editor. When the content of such editing contains .jpg images, then I get that these headers have already sent an error.

As I understand it, this is not for all images, but for some of them. For example, when there is only 1 image without errors. When there are 3, only for one I get this error.

I can not find any spaces or unwanted echo and print . I am stuck with this and I have no idea what to look for. Maybe you could give me some advice? I know this is harmless, but we still do not want to have errors in system.log.

+4
source share
3 answers

Sometimes we see "Headers Already Send ..." in system.log ... to prevent this, we must return our data to the controllers using one of these methods.

clean way:

$this->getResponse()->setBody($response);

or dirty way:

echo $response;

exit();

There are times when the "clean path" does not work, so we must use the "dirty way".

Use this if you get content through Ajax, as in CMS;)

+10
source

Oddly enough, I only created this post this morning, as I had a similar problem when debugging Magento.

http://codemagento.com/2011/03/debugging-headers-already-sent-error/

0
source

Alternatively, we could rewrite \ app \ code \ core \ Mage \ Adminhtml \ controllers \ Cms \ WysiwygController.php in the same way Magento 1.9.3 does. In our case, this changed this part of the directiveAction () function

  try { $image = Varien_Image_Adapter::factory('GD2'); $image->open($url); $image->display(); } catch (Exception $e) { $image = Varien_Image_Adapter::factory('GD2'); $image->open(Mage::getSingleton('cms/wysiwyg_config')->getSkinImagePlaceholderPath()); $image->display(); 

to

  try { $image = Varien_Image_Adapter::factory('GD2'); $image->open($url); } catch (Exception $e) { $image = Varien_Image_Adapter::factory('GD2'); $image->open(Mage::getSingleton('cms/wysiwyg_config')->getSkinImagePlaceholderPath()); } ob_start(); $image->display(); $this->getResponse()->setBody(ob_get_contents()); ob_end_clean(); 

Additional information (in German) on the right here . Verified with Magento CE 1.9.2.4.

0
source

Source: https://habr.com/ru/post/1342268/


All Articles