View Issue Details

IDProjectCategoryView StatusLast Update
0022011mantisbtbugtrackerpublic2016-12-30 19:11
ReporterMartinW Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindowsOS Version7 
Product Version1.3.4 
Target Version1.3.5Fixed in Version1.3.5 
Summary0022011: LOG_ALL causes error
Description

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

"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 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.

$g_log_level = LOG_ALL & ~LOG_EMAIL & ~LOG_EMAIL_RECIPIENT;

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
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT;

do not cause this problem.

TagsNo tags attached.
Attached Files
mantis1.jpg (307,872 bytes)

Activities

atrol

atrol

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?

dregad

dregad

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
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT;
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 http://www.mantisbt.org/support.php)

MartinW

MartinW

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.

<?php

$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.

Thanks.

atrol

atrol

2016-12-06 05:41

developer   ~0054691

Which version of PHP do you use?

MartinW

MartinW

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.

atrol

atrol

2016-12-06 06:17

developer   ~0054694

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

dregad

dregad

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)

dregad

dregad

2016-12-06 06:43

developer   ~0054697

PR https://github.com/mantisbt/mantisbt/pull/973

MartinW

MartinW

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 01:37

dregad

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
application.

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
preferences.

Fixes 0022011
Affected Issues
0022011
mod - core.php Diff File