Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27158

Default timezone is incorrect when not set in PHP configuration

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • 2.0, 2.0.1, 2.0.2, 2.0.9, 2.1.6, 2.2.3, 2.3
    • None
    • General
    • 20

    Description

      When 'date.timezone' is not set in the PHP server configuration, Moodle sets the base timezone to PHP's default which is 'Asia/Jayapura'. When you then set a timezone in the administration area, to say 'Australia/Adelaide', the time is half an hour too fast. If the 'date.timezone' is set in the PHP server configuration, this is not an issue.

      The problem seems to be that PHP is still thinking 'Asia/Jayapura' is the base timezone, which is GMT+9 hours. When Moodle stores the timestamp, it subtracts the 9 hours from the current time, storing a "UTC" timestamp value. When Moodle then goes to display a time (i.e. assignment conditional access times), it adds +9.5 hours to the timestamp which gives the incorrect time.

      When using "Server's local time", it works fine and there is no issue either. However, if Moodle is set to use "Server's local time", and then a user manually sets their timezone, it is again incorrect.

      Might be related to MDL-22625, but it seems a little different again.

      Attachments

        Issue Links

          Activity

            People

              moodle.com Moodle HQ
              jaseeey Jason Ilicic
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: