Thought I’d toss in my $0.02 on this subject since the same thing happened to me today. Here was my process:
First I commented out the exit statement on line ~1298 of document.parser.class.inc.php
if (!$ds) {
echo "Error while inserting event log into database. ";
//exit();
}
Then I added the $sql string to the end so I could see WHAT MODx was trying to log - thinking this might help me find out what I had undoubtedly done wrong in my snippet:
if (!$ds) {
echo "Error while inserting event log into database. ($sql)";
//exit();
}
Incidentally, by commenting out the exit(), the page worked fine... well except for the error message at the top. Then I got this SQL statement which proved very interesting. Not at all what I expected:
INSERT INTO
`dbname`.`prefix_event_log`
(eventid,type,createdon,source,description,user)
VALUES(1,3,1231255526,’snippetname - Snippet’,’It is not safe to rely on the system\’s timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected \’America/New_York\’ for \’EST/-5.0/no DST\’ instead
’,’1’)
* Some data (in italics) altered to protect the innocent.
Weird. A timezone issue? [... Jared hits Google for a while ...]
Sure enough, even though the phpInfo shows:
Default timezone America/New_York
It also shows no setting has been explicitly defined:
date.timezone no value no value
As it turns out, moving from PHP 4 to PHP 5 brings some changes in how error reporting happens with time settings. This was a case in point. A little more Googling showed me I needed to explicitly set the date.timezone setting in php.ini - which had previously commented out. It now looks like this:
[Date]
; Defines the default timezone used by the date functions
date.timezone = America/New_York
I restarted Apache, and almost like magic, the error was gone. I removed my modifications to document.parser.class.inc.php (because failure to do so immediately means I’llf orget for sure). And now everything is running smoothly again.