Reputation: 1391
Error : Unable to add cookies, header already sent.
I would like to know if there is any way I can diagnose above error efficiently.
I understand the cause of this error - when cookies are being sent after something else has been sent to the browser such as headers, html etc.
There are hundreds of files with thousands of lines of codes. If anyone knows a method (even if 3rd party, it doesn't matter) that will help me to find which contents are sent to the browser before cookies so I can manipulate that part of code easily. I'm having trouble locating actual place or code patch causing this error.
Generally this happens to many vBulletin users out there and vB staff tells you to disable mods/plugins etc. But i would like to know any efficient way to find problem location. There is no problem with <?php
etc. etc.
Upvotes: 1
Views: 2708
Reputation: 8853
Refer to header_sent()
function at point of cookie setting. php function header_sent() can help you.
bool headers_sent ([ string &$file [, int &$line ]] )
If the optional file and line parameters are set, headers_sent() will put the PHP source file name and line number where output started in the file and line variables.
Upvotes: 1