Moodle

Different timezone defaults in PHP 5.3 - rewrite time zone handling

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 1.9.6, 2.0
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

Warning: getdate(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1425 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1379 Warning: getdate(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1425 Warning: mktime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\calendar\lib.php on line 980 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\calendar\lib.php on line 980 Warning: mktime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\calendar\lib.php on line 114 Warning: mktime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\calendar\lib.php on line 115 Warning: mktime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1928 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1928 Warning: mktime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1248 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1379 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1375 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1376 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1375 Warning: strftime(): 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/Paris' for '2.0/DST' instead in C:\server\workspace\moodle20\lib\moodlelib.php on line 1376

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

workaround for now is to add
date_default_timezone_set('UTC');

into config.php

Show
Petr Škoda (skodak) added a comment - workaround for now is to add date_default_timezone_set('UTC'); into config.php
Hide
Petr Škoda (skodak) added a comment -

hmm, looks like the correct solution is set the default timezone in config.php or directly in php.ini
I suppose we can alter config-default.php and our installers + add docs

Show
Petr Škoda (skodak) added a comment - hmm, looks like the correct solution is set the default timezone in config.php or directly in php.ini I suppose we can alter config-default.php and our installers + add docs
Hide
Petr Škoda (skodak) added a comment -

not a bug, apparently this is a feature of PHp 5.3 - admins should specify the timezone in php.ini

Show
Petr Škoda (skodak) added a comment - not a bug, apparently this is a feature of PHp 5.3 - admins should specify the timezone in php.ini
Hide
Ralf Krause added a comment -

I added date_default_timezone_set('UTC'); into the config.php which fixed the problem with the debugging messages.
But now Moodle shows the wrong time in the logdata so the Moodle admin has to do more things.

I do not know what happens if the Moodle install dialog asks for the correct timezone? What must be done with daylight saving?

Show
Ralf Krause added a comment - I added date_default_timezone_set('UTC'); into the config.php which fixed the problem with the debugging messages. But now Moodle shows the wrong time in the logdata so the Moodle admin has to do more things. I do not know what happens if the Moodle install dialog asks for the correct timezone? What must be done with daylight saving?
Hide
Ralf Krause added a comment -

I tried the foolowing for my home address in Germany and this seems to be correct. Does this entry also register the daylight saving?

date_default_timezone_set('Europe/Berlin');

Show
Ralf Krause added a comment - I tried the foolowing for my home address in Germany and this seems to be correct. Does this entry also register the daylight saving? date_default_timezone_set('Europe/Berlin');
Hide
Petr Škoda (skodak) added a comment -

Just use your correct timezone string instead of UTC, php manual should include more information. In any case I would discourage you from using 5.3 on production servers.

Show
Petr Škoda (skodak) added a comment - Just use your correct timezone string instead of UTC, php manual should include more information. In any case I would discourage you from using 5.3 on production servers.
Hide
Petr Škoda (skodak) added a comment -

reopening, going to add info in config-dist.php

Show
Petr Škoda (skodak) added a comment - reopening, going to add info in config-dist.php
Hide
Petr Škoda (skodak) added a comment -

I have added some links and example into config-dist.php, I hope it will be enough.

Please note 1.8.x problems with PHP 5.3 will not be fixed.

Show
Petr Škoda (skodak) added a comment - I have added some links and example into config-dist.php, I hope it will be enough. Please note 1.8.x problems with PHP 5.3 will not be fixed.
Hide
Ralf Krause added a comment -

Hi Petr,

I think that we must get a system check for the installation and a new text field, so the admin can set his timezone for new Moodle installations. The check should look for a predefined setting in the php.ini.

We need also a check for the server information which will test if the default timezone is set. This should be shown on the page moodle/admin/environment.php . In this case the admin will get the chance to fix the problem.

Is it possible to set the default timezone from a PHP script .... probably no. It would be really unsave if you can set a global PHP constant from a script.

Ralf

Show
Ralf Krause added a comment - Hi Petr, I think that we must get a system check for the installation and a new text field, so the admin can set his timezone for new Moodle installations. The check should look for a predefined setting in the php.ini. We need also a check for the server information which will test if the default timezone is set. This should be shown on the page moodle/admin/environment.php . In this case the admin will get the chance to fix the problem. Is it possible to set the default timezone from a PHP script .... probably no. It would be really unsave if you can set a global PHP constant from a script. Ralf
Hide
Dan Marsden added a comment -

Hi Petr,

I'm not sure that having this just in config-dist.php is enough?

lots of users install Moodle via things like fantastico or use the web based gui to create a config.php for them - couldn't we add this as an option in the admin interface during fresh installs?

Show
Dan Marsden added a comment - Hi Petr, I'm not sure that having this just in config-dist.php is enough? lots of users install Moodle via things like fantastico or use the web based gui to create a config.php for them - couldn't we add this as an option in the admin interface during fresh installs?
Hide
Petr Škoda (skodak) added a comment -

I was hoping our ancient custom and buggy timezone handling will get rewritten in 2.0

Show
Petr Škoda (skodak) added a comment - I was hoping our ancient custom and buggy timezone handling will get rewritten in 2.0

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: