View Issue Details

IDProjectCategoryView StatusLast Update
0022011mantisbtbugtrackerpublic2016-12-30 19:11
ReporterMartinWAssigned Todregad 
Status closedResolutionfixed 
PlatformOSWindowsOS Version7
Product Version1.3.4 
Target Version1.3.5Fixed in Version1.3.5 
Summary0022011: LOG_ALL causes error

Specifying the log_level to be "LOG_ALL" causes the following message and the system becomes blocked.


'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 the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in 'D:\mantisbt-1.3.4\core\logging_api.php' line 108

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section. "

Steps To Reproduce

Simply add the line:

$g_log_level = LOG_ALL;

to the config_inc.php file and access the site. The error appears but the user is unable to progress further. Pressing the Back button as suggested does nothing except display the same message. The option can be part of a group but still have the same problem. e.g.


Additional Information

Logging_api.php line 108 also has no bearing on this error either as it is:

$t_now = date( config_get_global( 'complete_date_format' ) );

Also setting other logging levels, such as

do not cause this problem.

TagsNo tags attached.




2016-12-06 03:32


mantis1.jpg (307,872 bytes)


2016-12-06 04:07

developer   ~0054687

Did you follow the installation guide and run admin/check/index.php after finishing the installation?

If so, did you get any error or warnings, especially concerning timezone settings?



2016-12-06 04:37

developer   ~0054688

As the message says, it is required to set the timezone in your MantisBT / PHP environment.

This can be done in php.ini, or in your MantisBT config_inc.php file ($g_default_timezone).

Also setting other logging levels, such as
do not cause this problem.

This is most likely because no log events of this kind have been triggered on the page you're trying to load.

This is not a bug or feature request for MantisBT (you are asking for help on how to configure the system). I am therefore resolving this issue as "no change required".

Please use the forums, the mantisbt-help mailing list or IRC to get support on customizing and using MantisBT (see



2016-12-06 05:28

reporter   ~0054689

Sorry but I did set the time zone as requested to something, specifically:
$g_default_timezone = 'Europe/London';

And I did run admin/check/index.php - twice - as I got the error originally about timezones.

I'm not asking for help to configure the system - simply stating a fact that if you add the LOG_ALL option to the config_inc.php file, the system fails. This is all I have in the config_inc.php file.


$g_hostname               = 'localhost';
$g_db_type                = 'mysqli';
$g_database_name          = 'bugtracker';
$g_db_username            = 'root';
$g_db_password            = 'xxxxxxxxxxx';  

$g_default_timezone = 'Europe/London';

$g_crypto_master_salt = 'kSzCPy4jnkpkOCtxEadN1mSuI7hblb58Z0shqqiNgZg=';

$g_log_level = LOG_ALL;

and this fails. Removing the last line allows me to login in, otherwise I get the error message.




2016-12-06 05:41

developer   ~0054691

Which version of PHP do you use?



2016-12-06 05:55

reporter   ~0054692

PHP V5.4.27

And this doesn't happen with Mantis Version 1.2.15 on the same machine.



2016-12-06 06:17

developer   ~0054694

What's the setting of date.timezone in your php.ini?



2016-12-06 06:21

developer   ~0054695

OK, I see what the problem is and can reproduce it.

core.php initializes the timezone from config_inc.php, but this happens only after including several APIs.

Specifically, the issue is with plugin initializations executing DB queries; db_query() attempts to log the query (LOG_DATABASE in database_api.php:447).

That's fairly easy to fix.

That being said, you really should set the timezone globally at PHP level (i.e. set date.timezone in php.ini)



2016-12-06 06:43

developer   ~0054697




2016-12-07 03:29

reporter   ~0054709

I understand what you’re saying and thought it was probably something like the order of initialisation items. Will update php.ini to include the correct one.

Many thanks for taking the time and perseverance to respond!

Related Changesets

MantisBT: master-1.3.x 1093aa11

2016-12-06 06:37:06


Committer: vboctor Details Diff
Initialize timezone early

log_event() uses date(), which triggers a PHP notice when the default
timezone has not been set in php.ini (date.timezone) or by the

Since core.php initializes the timezone only after including several
APIs, depending on log and error level settings in config_inc.php, this
can prevent MantisBT from operating properly.

To prevent this problem, we now set the default timezone as early as we
can, and change it later if necessary according to the user's

Fixes 0022011
mod - core.php Diff File

Issue History

Date Modified Username Field Change
2016-12-06 03:32 MartinW New Issue
2016-12-06 03:32 MartinW File Added: mantis1.jpg
2016-12-06 04:07 atrol Status new => feedback
2016-12-06 04:07 atrol Note Added: 0054687
2016-12-06 04:07 atrol Priority high => normal
2016-12-06 04:07 atrol Severity block => minor
2016-12-06 04:37 dregad Assigned To => dregad
2016-12-06 04:37 dregad Status feedback => resolved
2016-12-06 04:37 dregad Resolution open => no change required
2016-12-06 04:37 dregad Note Added: 0054688
2016-12-06 05:28 MartinW Note Added: 0054689
2016-12-06 05:41 atrol Assigned To dregad =>
2016-12-06 05:41 atrol Status resolved => feedback
2016-12-06 05:41 atrol Resolution no change required => reopened
2016-12-06 05:41 atrol Note Added: 0054691
2016-12-06 05:55 MartinW Note Added: 0054692
2016-12-06 05:55 MartinW Status feedback => new
2016-12-06 06:17 atrol Status new => feedback
2016-12-06 06:17 atrol Note Added: 0054694
2016-12-06 06:21 dregad Assigned To => dregad
2016-12-06 06:21 dregad Status feedback => assigned
2016-12-06 06:21 dregad Note Added: 0054695
2016-12-06 06:43 dregad Target Version => 1.3.5
2016-12-06 06:43 dregad Note Added: 0054697
2016-12-07 03:29 MartinW Note Added: 0054709
2016-12-11 23:12 vboctor Changeset attached => MantisBT master-1.3.x 1093aa11
2016-12-11 23:12 vboctor Assigned To dregad => vboctor
2016-12-11 23:12 vboctor Status assigned => resolved
2016-12-11 23:12 vboctor Fixed in Version => 1.3.5
2016-12-12 01:21 vboctor Assigned To vboctor => dregad
2016-12-30 15:54 vboctor Status resolved => closed
2016-12-30 19:11 dregad Resolution reopened => fixed