MODx Bug/Feature Tracker and Feature Requests
Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!
FS#296 — Cannot modify header information error if visitor logging on
Attached to Project —
MODx
Opened by doze (doze) - Sunday, 05 March 2006, 07:19PM
Last edited by Ryan Thrash (rthrash) - Saturday, 29 July 2006, 02:57PM
Opened by doze (doze) - Sunday, 05 March 2006, 07:19PM
Last edited by Ryan Thrash (rthrash) - Saturday, 29 July 2006, 02:57PM
| Task Type | Bug Report |
|---|---|
| Category | Core Distribution |
| Status | Closed |
| Assigned To |
Jason Coward (opengeek) |
| Operating System | All |
| Severity | High |
|---|---|
| Priority | Normal |
| Reported Version | 0.9.1 |
| Due in Version | 0.9.5 |
| Due Date | Undecided |
| Percent Complete |
|
Details
In some server enviroments, if visitor logging is on, it will produce parse error on the first page load at every visit to the site (when user has a new session).If the visitor logging is set to be off, there aren't any parse errors visible at front end. But if the visitor logging is on, there will be this error at the page footer at the first page load:
Error: Cannot modify header information - headers already sent
Error type/ Nr.: Warning - 2
File: /www/03/net/modx/manager/includes/document.parser.class.inc.php
Line: 416
Line 416 source: header($header);
There is probably an error somewhere in the visitor logging code that will produce the following error in some server enviroments:
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Duplicate entry '2147483647' for key 1 »
SQL: INSERT INTO `enDB`.modx_log_user_agents(id, data) VALUES('3767326138', 'Firefox/1.5.0.1')
And this is sent after the headers are allready out, so there will be the "headers allready sent" error visible..
My server specs:
MODx: 0.9.1 Out-of-the-Box, only installed
OS: Debian 3.1, Linux 2.6 (x86_64)
WWW: Apache 1.3
PHP: PHP 4.4.1 (+gd 2.0, curl, ctype, libxml)
SQL: MySQL 4.1.11
More information & discuss here: http://modxcms.com/forums/index.php/topic,2956.0.html
This task depends upon
This task blocks these from closing
Closed by Ryan Thrash (rthrash)
Saturday, 30 December 2006, 11:28AM
Reason for closing: Implemented
Additional comments about closing: stats tracking removed so should be fixed
Saturday, 30 December 2006, 11:28AM
Reason for closing: Implemented
Additional comments about closing: stats tracking removed so should be fixed
Here is the config :
Apache 1.3
MySQL 3.23.43
PHP Version 4.4.2
If full phpinfo() is needed mail me
In modx_log_hosts the id is of type int(11), which has a max value of 2147483647, and the crc32() of the host name can result in number larger. Both are number of 4bytes, but the db is signed, halfing the max value. This makes this error only intermittent, and depending on which host is viewing the page :) nasty.
The fix for this is to change the type to be unsigned (or just make it a mediumint)
So in setup.sql, line 85 should be changed from:
CREATE TABLE IF NOT EXISTS `{PREFIX}log_hosts` (
`id` int(11) NOT NULL default '0',
`data` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=InnoDB COMMENT='Contains visitor statistics.';
to:
CREATE TABLE IF NOT EXISTS `{PREFIX}log_hosts` (
`id` int UNSIGNED NOT NULL default '0',
`data` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=InnoDB COMMENT='Contains visitor statistics.';
of course this only helps on new installs... one would have to add an alter command to fix it on existing setups:
ALTER TABLE `modx_log_hosts` CHANGE `id` `id` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0';
assuming its got the modx prefix that is.
hope this helps
-auz
I've also noticed this problem in a few other places in the logs section of the code, which is I guess why the suggested solution has been to turn it off.
-auz