Friday, April 2, 2010

How to fix SYSTEM WARNING: date() in the Mantis package

If your Mantis installation in Fedora gives this kind of warnings on page loads:

SYSTEM WARNING: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 'Europe/Berlin' for 'CEST/2.0/DST' instead

the fix is easy, as the message suggest you need to add a call to date_default_timezone_set() somewhere in the code, with one of the PHP timezone codes as the argument.

But where exactly?

Right now, my suggestion is to use the file /etc/mantis/config_inc.php and add it as the last line in the file. This way, your modification will not be overwritten on the next update.