Ticket #4994 (closed defect (bug): fixed)
Default Timezone settings
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | General | Version: | 2.3 |
| Severity: | major | Keywords: | has-patch needs-testing early |
| Cc: |
Description
I setup Beta3 on NexentaCP (an OpenSolaris distribution, downstream from Ubuntu), the php error notifications are set as E_ALL & ~E_NOTICE, yet I get these messages when working with dates:
Warning: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /var/www/wordpress/wp-includes/functions.php on line 14
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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 had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm in /var/www/wordpress/wp-includes/functions.php on line 23
These warning messages make wordpress completely unusable out of the box without having to hard code timezones in either php.ini or templates. The warnings appear 15 times on the front page of a default install of wordpress 2.3 beta3. There should be a way to explicitly set the timezones for the wordpress installation.
Some documentation I found regarding this issue: https://answers.google.com/answers/threadview?id=739376 http://us2.php.net/manual/en/function.date-default-timezone-set.php
Attachments
Change History
The reason it isn't a 5.1 problem is that DateTime isn't included by default.
- Keywords has-patch needs-testing added
Could you try the attached patch?
It sets the timezone to UTC if it's an affected version of PHP and both the TZ environment variable and the date.timezone ini setting aren't set.
Make a user option for it. I would not like UTC in my blogs and on a shared hoster one usually can not change env vars / php.ini settings.
comment:6
darkdragon — 4 years ago
How the default works is that you set it first and then you change it whenever you need to. The DateTime classes allow you to create timezones on the fly, so it wouldn't be an issue if PHP4 compatibility wasn't required. However, you can still change it when you get passed the point where the option file is included and have access to that API.
It should probably be a function, in that case.
comment:7
darkdragon — 4 years ago
Traction seems to have been lost on this. For such a trivial problem with a trivial solution it should be committed.
darkdragon — 4 years ago
-
attachment
4994.r6668.diff
added
Sets the default timezone based off of the settings in gmt_offset for the blog. Does this, even if it is already set. Based off of r6668
comment:8
darkdragon — 4 years ago
Patch uses the setting in the gmt_offset to set the timezone and does this even if the default timezone has been set. Some hosts set the timezone based on where the servers are located. So this will keep the time functions where the blog admin is located. Will not work per user, so it might be worth setting it to GMT instead so that the time calculations work.
comment:9
darkdragon — 4 years ago
Second patch sets the default timezone based off of GMT to work with WordPress gmt offsets for both the server and users.
darkdragon — 4 years ago
-
attachment
4994.2.r6668.diff
added
Second patch sets the default timezone to GMT to work with the wordpress calculations for GMT offsets. Based off of r6668
comment:10
westi — 4 years ago
- Keywords early added
- Owner changed from anonymous to westi
- Status changed from new to assigned
Moving to 2.6 - needs doing early in a release cycle
suggesting wontfix. no activity, and E_STRICT errors are being worked out of trunk, in php pre-5.2, 5.3 and even 6.0. See: #8701
- Status changed from assigned to closed
- Resolution set to fixed
- Milestone changed from 2.9 to 2.8
fixed when when changed the error_reporting stuff in 2.8

Should be mentioned that this is a PHP >5.2 setup.
this can be solved in wp-settings.php
if (PHP5) { date_timezone_set('UTC'); }And only on hosts that don't already set this value.