[MSU Sitemaps] Headers already sent
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
[MSU Sitemaps] Headers already sent
[Thu Sep 04 08:44:51 2008] [error] PHP Warning: Cannot modify header information - headers already sent by (output started at /WEBADDRESSREMOVED/sitemaps.php:151) in /WEBADDRESSREMOVED/sitemaps.php on line 93
Any ideas?
Thanks!
Re: [MSU Sitemaps] Headers already sent
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
Re: [MSU Sitemaps] Headers already sent
I don't even get the correllation and how this makes any sense....
Re: [MSU Sitemaps] Headers already sent
BlessIsaacola wrote:and why is this a problem now not before?
You answer your own original question - someone made changes to Zen Cart files.
BlessIsaacola wrote:Having a space after ?> is NOT a technical or code problem. In fact there are several files that the Zen Cart team and other mod creators left a blank space at the end of ?>.
Yes and there are several errors left by Zen Cart team and mod creators, but only carriage return is allowed after ?>.
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
Re: [MSU Sitemaps] Headers already sent
Code: Select all
$sitemap = strtolower(trim($_GET['showMap']));
if(strpos($sitemap, 'http://') === false && strpos($sitemap, '..') === false && file_exists(UN_FULLAPP_PATH.SM_DIR_SITEMAPS.'/'.$sitemap.'.php')) {
require(UN_FULLAPP_PATH.SM_DIR_SITEMAPS.'/'.$sitemap.'.php');
} else {
header("HTTP/1.1 404 Document Not Found");
exit();
}
Line 93 is:
Code: Select all
header("HTTP/1.1 404 Document Not Found");
Code: Select all
function siteMap($url) {
$this->timeZone = substr(date('O'), 0, 3);
header('Content-Type: application/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
$this->baseUrl = $url;
}
Line 151 is:
Code: Select all
echo '<?xml version="1.0" encoding="UTF-8"?>';
If there is no problem with the code, does anyone know how to make this code smarter to check for header before redeclaring it. In others words, if header is already declared move on and don't try to do it again (thereby triggering the error).
Re: [MSU Sitemaps] Headers already sent
Code: Select all
ob_start();
I am little sad you still don't trust me This is one of the PHP basics.
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
Re: [MSU Sitemaps] Headers already sent
I simply posted the problem I was experiencing with sitemap and I never said it was MSU sitemap problem. Obviously, it's probably due to an editor messing up one of the 1,000s of files on the server. Unfortunately, I don't know which one (if I did I would have removed the extra blank space). Since at this time, sitemap is the only mod that is triggering this error, that's why I posted here.
Even in a perfect world there will be mod conflicts so that's not what's important to me... it's getting to the solution of the problem that I am interested in.
I basically posted originally looking for help and you basically said this is NOT MSU Sitemap problem which nobody said it was. I was just looking for people to brianstorm with me to get to the bottom of the problem I am experiencing.
I will add the code you provided and report back.
Thanks!
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
Re: [MSU Sitemaps] Headers already sent
-
- Follower
- Posts: 98
- Joined: Sun Feb 03, 2008 9:48 pm
- Location: Kennesaw, GA
- Contact:
Re: [MSU Sitemaps] Headers already sent
I applied this code:
Code: Select all
ob_start();
Do you see any issue on line 151 of sitemaps.php:
Code: Select all
echo '<?xml version="1.0" encoding="UTF-8"?>';
Code: Select all
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
Again, I am not saying anything is wrong with the code, I am just thinking out loud. Thanks for the help!