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

Default timezone is incorrect when not set in PHP configuration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0, 2.0.1, 2.0.2, 2.0.9, 2.1.6, 2.2.3, 2.3
    • Fix Version/s: BACKEND
    • Component/s: General
    • Story Points:
      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

              Assignee:
              moodle.com moodle.com
              Reporter:
              jaseeey Jason Ilicic
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: