Bug #20786
closedPHP-5.3 Warnings concerning missing timezone settings
0%
Description
Warning: date() [function.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/Berlin' for 'CEST/2.0/DST' instead in /Users/michiel/htdocs/sources/typo3_src-4.3.trunk/t3lib/class.t3lib_div.php on line 4389
(issue imported from #M11587)
Files
Updated by Michiel Roos over 15 years ago
Warning: date() [function.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/Berlin' for 'CEST/2.0/DST' instead in /Users/michiel/htdocs/sources/typo3_src-4.3.trunk/typo3/mod/tools/em/class.em_index.php on line 996
Updated by Stefan Geith over 15 years ago
Solution:
Edit the php.ini file on your server e.g. with
vi /etc/php5/apache2/php.ini
Search for "date.timezone" and add or modirfy the line e.g. like this:
date.timezone = "Europe/Berlin"
DonĀ“t forget to restart apache e.g. by
apache2ctl graceful
Updated by Michiel Roos over 15 years ago
You are telling me that you want to make this decision for ALL your clients, no matter in what country they live. If they host on your server, you impose YOUR region upon them?
That will not do. A more flexible solution is needed. Think of a timezone selector in the install tool.
Updated by Stefan Geith over 15 years ago
Sure - this only makes sense for servers with clients/sites all from the same timezone.
Updated by Christian Weiske over 15 years ago
This is not a Typo3 or PHP bug, it's normal behavior. Could this be closed as "Bogus"?
Updated by Michiel Roos over 15 years ago
Christian,
Can you please explain clearly to me how this big warning popping up on my screen is 'bogus'.
Thank you.
Updated by Christian Weiske over 15 years ago
This is a server setting - you just did not configure your server (php) properly after upgrading your php version. There is nothing typo3 can do about that.
http://de3.php.net/manual/en/datetime.configuration.php#ini.date.timezone
Updated by Stefan Geith over 15 years ago
I think, that it would be useful to have init.php set the timezone by a setting in localconf.php, as Michiel mentioned in Note 0029849 above.
PHP.INI setting should/could only be a default.
Updated by Michiel Roos over 15 years ago
Christian,
On the page http://de3.php.net/manual/en/datetime.configuration.php#ini.date.timezone
It indeed says: date.timezone; default: ""
So, I installed a stock PHP that is configured 'as is' and I get a warning from the date() function.
That's how PHP is set up.
If an application like TYPO3 want's to use the date() function, it must initialize the correct TimeZone if there is none set by php.ini (which is the case by default).
Updated by Rupert Germann about 15 years ago
hi,
I attached a patch which adds a new conf vars parameter "phpDateTimeZone" which sets the timezone to "CET" by default.
This is the same as "serverTimeZone" which is also set to CET (GMT+1) by default.
Updated by Dmitry Dulepov about 15 years ago
Here is a description of the "date.timezone" from the PHP documentation:
date.timezone string The default timezone used by all date/time functions if the TZ environment variable isn't set.
This setting is PHP_INI_ALL. It is possible to configure this for each host separately in the vhost configuration or in the .htaccess.
Updated by Dmitry Dulepov about 15 years ago
Comments to my version of the patch (from the core list);
Proper solution should have two settings:
- "default time zone" (CET)
- "force time zone" (empty)
Proper algorithm:
- Is "force" setting empty? |- "no" -> set it. The end |- "yes" -> Is ini_get('date.timezone') value empty? |-> "yes" set "default" setting. The end |-> "no" Nothing to do. The end.