Project

General

Profile

Actions

Bug #20786

closed

PHP-5.3 Warnings concerning missing timezone settings

Added by Michiel Roos over 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2009-07-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

11587.diff (3.68 KB) 11587.diff Administrator Admin, 2009-11-04 20:03
11587-alt.diff (3.23 KB) 11587-alt.diff Administrator Admin, 2009-11-05 14:15
11587-v7.diff (3.04 KB) 11587-v7.diff Administrator Admin, 2010-04-30 15:30
11587_v8.diff (2.96 KB) 11587_v8.diff Administrator Admin, 2010-04-30 15:55

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #21632: Can't access 'Basic Configuration' on a fresh installClosedOliver Hader2009-11-21

Actions
Has duplicate TYPO3 Core - Bug #21742: PHP Warning: mktime()ClosedChris topher2009-11-30

Actions
Actions #1

Updated by Michiel Roos over 14 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

Actions #2

Updated by Stefan Geith over 14 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

Actions #3

Updated by Michiel Roos over 14 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.

Actions #4

Updated by Stefan Geith over 14 years ago

Sure - this only makes sense for servers with clients/sites all from the same timezone.

Actions #5

Updated by Christian Weiske over 14 years ago

This is not a Typo3 or PHP bug, it's normal behavior. Could this be closed as "Bogus"?

Actions #6

Updated by Michiel Roos over 14 years ago

Christian,

Can you please explain clearly to me how this big warning popping up on my screen is 'bogus'.

Thank you.

Actions #7

Updated by Christian Weiske over 14 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

Actions #8

Updated by Stefan Geith over 14 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.

Actions #9

Updated by Michiel Roos over 14 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).

Actions #10

Updated by Rupert Germann over 14 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.

Actions #11

Updated by Dmitry Dulepov over 14 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.

Actions #12

Updated by Dmitry Dulepov over 14 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.

Actions #13

Updated by Tobias Liebig almost 14 years ago

adjusted, latest patch attached

Actions #14

Updated by Tobias Liebig almost 14 years ago

committet to trunk: r7468

Actions

Also available in: Atom PDF