Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
829 views
in Technique[技术] by (71.8m points)

debugging - Magento Debug HEADERS ALREADY SENT error

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:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.php:44
 [1] C:xampphtdocswww.mysite.comlibendControllerResponseAbstract.php:727
 [2] C:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.php:75
 [3] C:xampphtdocswww.mysite.comappcodecoreMageCoreControllerVarienFront.php:188
 [4] C:xampphtdocswww.mysite.comappcodecoreMageCoreModelApp.php:304
 [5] C:xampphtdocswww.mysite.comappMage.php:596
 [6] C:xampphtdocswww.mysite.comindex.php:81

I know what "headers already sent" means but I have no idea what file is causing this and the trace doesn't really give me any information.

Is there a way of finding out the offending file?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here's the hard way.

Find the location in the file that's doing the logging

C:xampphtdocswww.mysite.comappcodecoreMageCoreControllerResponseHttp.php 
Mage::log('HEADERS ALREADY SENT: '.mageDebugBacktrace(true, true, true));

Add logging to get a copy of every file included/required so far

Mage::log(print_r(get_included_files(),true));

You can add this logging directly to the core file if you remember to restore the file to it's pre messed with condition, or you can add a temporary copy at

app/code/local/Mage/Core/Controller/Response/Http.php

as long as you remember to remove it when you're done (or just use git).

Check this list of files for the usual white-space suspects, and then check them for any functions that might produce output (echo, print, readfile, there's probably more)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...