Project: moodle
Issue MDL-27158: Default timezone is incorrect when not set in PHP configuration
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.
Story points: 20