[php-maint] Bug#571762: [php5] please get rid of "Warning: date() [function.date]: It is not safe to rely on the system's timezone settings."

Filipus Klutiero chealer at gmail.com
Sat Feb 27 20:53:42 UTC 2010


Package: php5
Version: 5.3.1-5
Severity: wishlist

With PHP 5.3, it is now strongly recommended to set the timezone; failure to 
do so makes date('U'), for example, trigger an E_WARNING (while time() is 
fine): http://www.php.net/manual/en/function.date-default-timezone-set.php
 This is really annoying. For example:

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 'America/New_York' for 'EST/-5.0/no DST' 
instead in /var/www/tiki/trunk/lib/tikilib.php on line 47

I have *no idea* where 'EST/-5.0/no DST' comes from, although the system *is* 
in GMT-5. IMO, there's even a bug here. The default PHP configuration doesn't 
set date.timezone. This is, IMO, the right thing to do. Searching for elements 
of this message on Google gives an idea of how much this change broke.

Telling me that my Debian system's timezone settings are unreliable is not 
something I expect from software coming from timezones less than 10 years 
behind mine. A *change* in this direction is quite frustrating.

Trying to use date_default_timezone_get() also returns America/New York.
Warning: date_default_timezone_get() [function.date-default-timezone-get]: 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 'America/New_York' 
for 'EST/-5.0/no DST' instead in /var/www/tiki/test.php on line 4

Since date_default_timezone_set() was not used, TZ is not set and 
date.timezone was not set, date_default_timezone_get() must be "Querying the 
host operating system (if supported and allowed by the OS)".

Current default time zone: 'America/Montreal'


--- System information. ---
Architecture: i386
Kernel:       Linux 2.6.32-trunk-amd64

Debian Release: squeeze/sid
  990 testing         security.debian.org 
  990 testing         ftp.ca.debian.org 
  500 unstable        ftp.ca.debian.org 

--- Package information. ---
Depends                           (Version) | Installed
===========================================-+-==============
libapache2-mod-php5           (>= 5.3.1-5)  | 5.3.1-5
 OR libapache2-mod-php5filter (>= 5.3.1-5)  | 
 OR php5-cgi                   (>= 5.3.1-5) | 
php5-common                    (>= 5.3.1-5) | 5.3.1-5


Package's Recommends field is empty.

Package's Suggests field is empty.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20100227/45e5ca00/attachment-0001.htm>


More information about the pkg-php-maint mailing list