2012-10-21 20:38:12 |
Dominik Angehrn |
bug |
|
|
added bug |
2012-10-22 19:07:26 |
Paul Gevers |
affects |
cacti (Ubuntu) |
php5 (Ubuntu) |
|
2012-10-22 19:09:10 |
Paul Gevers |
summary |
No graph updates after upgrade to 12.10 because date.timezone not set in php.ini |
date_default_timezone_get() broken after upgrade to 12.10 |
|
2012-10-24 07:49:55 |
Robie Basak |
description |
After release upgrading from 12.04 to 12.10, I remarked that the graphs are not updated anymore and the modify date of the files in /var/lib/cacti/rra was a timestamp before the upgrade.
I had many lines in /var/log/cacti/poller-error.log like this one:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/cacti/site/lib/functions.php on line 486
According to the FAQ page of cacti, I adjusted the php.ini in /etc/php5/cli and /etc/php5/apache2:
http://docs.cacti.net/faq#time_zone_warning
According to the PHP documentation, the behaviour in PHP 5.4 changed:
http://www.php.net/manual/en/function.date-default-timezone-get.php
First I thought that it is a bug of the packages php5-cli and libapache2-mod-php5 which do not set the date.timezone in their respective php.ini files. You can see that if you execute the following 2 commands:
dpkg-query --control-show libapache2-mod-php5 postinst
dpkg-query --control-show php5-cli postinst
There is only the default php.ini from the package copied without setting the date.timezone variable or let the user choose one.
But then I recognized, that the PHP script is executed to the end, also if the date.timezone variable is not set in php.ini
Let me demonstrate this in 3 examples:
1) Ubuntu 11.10 with timezone Europe/Zurich in /etc/timezone, no date.timezone set in php.ini and PHP version 5.3.6-13ubuntu3.9:
user@hostname1:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/cli/php.ini; echo; php -r 'echo date_default_timezone_get()."\n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime("now")."\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric
Linux hostname1 2.6.32-042stab061.2 #1 SMP Fri Aug 24 09:07:21 MSK 2012 i686 i686 i386 GNU/Linux
Europe/Zurich
; http://php.net/date.timezone
;date.timezone =
Europe/Berlin
5.3.6-13ubuntu3.9
Sun, 21 Oct 2012 22:21:12 +0200
1350850872
all commands executed with success
user@hostname1:~$
2) Ubuntu 12.10 with timezone Europe/Zurich in /etc/timezone, no date.timezone set in php.ini and PHP version 5.4.6-1ubuntu1:
user@hostname2:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/cli/php.ini; echo; php -r 'echo date_default_timezone_get()."\n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime("now")."\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
Linux hostname2 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Europe/Zurich
; http://php.net/date.timezone
;date.timezone =
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
5.4.6-1ubuntu1
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
Sun, 21 Oct 2012 19:33:45 +0000
PHP Warning: strtotime(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
1350848025
all commands executed with success
user@hostname2:~$
2) Ubuntu 12.10 with timezone Europe/Zurich in /etc/timezone, date.timezone set in php.ini to Europe/Zurich and PHP version 5.4.6-1ubuntu1:
user@hostname3:~$ echo; lsb_release -a; echo; uname -a; echo; cat /etc/timezone; echo; grep "date\.timezone" /etc/php5/cli/php.ini; echo; php -r 'echo date_default_timezone_get()."\n"; echo phpversion()."\n"; echo date("r")."\n"; echo strtotime("now")."\n"; echo "\nall commands executed with success\n\n";'
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
Linux hostname3 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Europe/Zurich
; http://php.net/date.timezone
date.timezone = "Europe/Zurich"
Europe/Zurich
5.4.6-1ubuntu1
Sun, 21 Oct 2012 21:35:16 +0200
1350848116
all commands executed with success
user@hostname3:~$
I am really not sure whether this is a bug in cacti (because the graphs are not updated although the not set timezone in php.ini should let the poller finish his work) or in php5-cli/libapache2-mod-php5 (which should either interact with the user to ask which timezone to set in the php.ini or take the timezone from /etc/timezone), I just recognized that the graphs in cacti did not update after the release upgrade and it worked again after setting date.timezone in both php.ini files and reloading apache2.
IMHO it has to be solved either in the cacti package or the bug should be assigned to php5-cli and libapache2-mod-php5 to let them set the date.timezone variable in the postinstall routine.
package versions:
user@hostname3:~$ LC_ALL=C apt-cache policy cacti
cacti:
Installed: 0.8.8a-3
Candidate: 0.8.8a-3
Version table:
*** 0.8.8a-3 0
500 http://ch.archive.ubuntu.com/ubuntu/ quantal/universe amd64 Packages
100 /var/lib/dpkg/status
user@hostname3:~$ LC_ALL=C apt-cache policy php5-cli
php5-cli:
Installed: 5.4.6-1ubuntu1
Candidate: 5.4.6-1ubuntu1
Version table:
*** 5.4.6-1ubuntu1 0
500 http://ch.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
100 /var/lib/dpkg/status
user@hostname3:~$ LC_ALL=C apt-cache policy libapache2-mod-php5
libapache2-mod-php5:
Installed: 5.4.6-1ubuntu1
Candidate: 5.4.6-1ubuntu1
Version table:
*** 5.4.6-1ubuntu1 0
500 http://ch.archive.ubuntu.com/ubuntu/ quantal/main amd64 Packages
100 /var/lib/dpkg/status
user@hostname3:~$ |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "UTC")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
|
2012-10-24 07:50:48 |
Robie Basak |
summary |
date_default_timezone_get() broken after upgrade to 12.10 |
php packaging does not automatically set timezone in php.ini |
|
2012-10-24 07:51:15 |
Robie Basak |
php5 (Ubuntu): importance |
Undecided |
Medium |
|
2012-10-24 07:51:15 |
Robie Basak |
php5 (Ubuntu): status |
New |
Triaged |
|
2012-10-24 07:51:20 |
Robie Basak |
bug |
|
|
added subscriber Robie Basak |
2012-10-24 08:20:27 |
Robie Basak |
description |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "UTC")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Not affected: 5.4.4-7 (sid)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "UTC")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
|
2012-10-24 08:24:32 |
Robie Basak |
bug watch added |
|
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673763 |
|
2012-10-24 08:24:32 |
Robie Basak |
bug task added |
|
php5 (Debian) |
|
2012-10-24 08:26:56 |
Robie Basak |
summary |
php packaging does not automatically set timezone in php.ini |
Regression in system fallback for date_default_timezone_get() |
|
2012-10-24 08:28:16 |
Robie Basak |
description |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Not affected: 5.4.4-7 (sid)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "UTC")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Not affected: 5.4.4-7 (sid)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "Europe/London")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
|
2012-10-24 09:22:32 |
Dominik Angehrn |
information type |
Public |
Public Security |
|
2012-10-24 09:22:39 |
Dominik Angehrn |
information type |
Public Security |
Public |
|
2012-10-24 10:18:05 |
Bug Watch Updater |
php5 (Debian): status |
Unknown |
Fix Released |
|
2012-10-24 11:04:05 |
Robie Basak |
attachment added |
|
fix-system-timezone.patch https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1069529/+attachment/3411480/+files/fix-system-timezone.patch |
|
2012-10-24 12:17:45 |
Ubuntu Foundations Team Bug Bot |
tags |
quantal |
patch quantal |
|
2012-10-24 12:17:53 |
Ubuntu Foundations Team Bug Bot |
bug |
|
|
added subscriber Ubuntu Review Team |
2012-10-24 12:23:22 |
Robie Basak |
nominated for series |
|
Ubuntu Quantal |
|
2012-10-24 13:34:12 |
Robie Basak |
description |
An upstream change in PHP requires php.ini to have the timezone set in there, instead of PHP using the system timezone as one might expect.
This is new in PHP 5.4.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Not affected: 5.4.4-7 (sid)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
Test Case:
Run:
$ php -r 'echo date_default_timezone_get()."\n";'
Expected results: timezone (eg. "Europe/London")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone). |
[Impact]
A regression of timezone handling between Precise and Quantal means that PHP scripts that depend on the system timezone now use UTC instead. This breaks arbitrary PHP scripts - eg. cactus stops working as expected.
Not affected: 5.3.10-1ubuntu3.4 (Precise)
Affected: 5.4.6-1ubuntu1 (Quantal)
Not affected: 5.4.4-7 (sid)
Workaround: edit /etc/php5/*/php.ini, uncomment the "date.timezone" line and set it to what you need.
[Test Case]
1. Set a timezone other than UTC using "dpkg reconfigure tzdata".
2. $ php -r 'echo date_default_timezone_get()."\n";'
Expected results: system timezone (eg. "Europe/London")
Actual results:
PHP Warning: 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Command line code on line 1
UTC
(where in this case UTC is the system timezone).
[Regression Potential]
This patch was previously used by Debian and inadvertently dropped, causing this regression. It has already been re-added in Debian. The change only touches the guess_timezone function and adds an additional fallback. If there is an inadvertent regression, it is likely to be in timezone selection code. |
|
2012-10-24 13:35:49 |
Robie Basak |
attachment added |
|
fix-system-timezone.debdiff https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1069529/+attachment/3411708/+files/fix-system-timezone.debdiff |
|
2012-10-24 13:38:47 |
Robie Basak |
attachment added |
|
Build log https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1069529/+attachment/3411713/+files/php5_5.4.6-1ubuntu2_amd64.build |
|
2012-10-24 13:41:59 |
Robie Basak |
bug |
|
|
added subscriber Ubuntu Sponsors Team |
2012-11-03 22:33:32 |
Benjamin Drung |
bug task added |
|
php5 (Ubuntu Quantal) |
|
2012-11-07 15:34:00 |
Marc Deslauriers |
nominated for series |
|
Ubuntu Raring |
|
2012-11-07 15:34:00 |
Marc Deslauriers |
bug task added |
|
php5 (Ubuntu Raring) |
|
2012-11-07 15:34:10 |
Marc Deslauriers |
php5 (Ubuntu Quantal): status |
New |
Triaged |
|
2012-11-07 15:34:12 |
Marc Deslauriers |
php5 (Ubuntu Quantal): importance |
Undecided |
Medium |
|
2012-11-07 21:36:21 |
Marc Deslauriers |
php5 (Ubuntu Raring): status |
Triaged |
Fix Committed |
|
2012-11-07 21:36:25 |
Marc Deslauriers |
removed subscriber Ubuntu Sponsors Team |
|
|
|
2012-11-07 21:36:34 |
Marc Deslauriers |
bug |
|
|
added subscriber Ubuntu Stable Release Updates Team |
2012-11-07 21:40:36 |
Marc Deslauriers |
bug |
|
|
added subscriber Marc Deslauriers |
2012-11-08 04:08:11 |
Launchpad Janitor |
php5 (Ubuntu Raring): status |
Fix Committed |
Fix Released |
|
2012-11-09 05:04:18 |
Launchpad Janitor |
branch linked |
|
lp:ubuntu/php5 |
|
2012-11-15 00:55:12 |
Clint Byrum |
php5 (Ubuntu Quantal): status |
Triaged |
Fix Committed |
|
2012-11-15 00:55:16 |
Clint Byrum |
bug |
|
|
added subscriber SRU Verification |
2012-11-15 00:55:20 |
Clint Byrum |
tags |
patch quantal |
patch quantal verification-needed |
|
2012-11-15 01:47:07 |
Launchpad Janitor |
branch linked |
|
lp:ubuntu/quantal-proposed/php5 |
|
2012-11-15 09:28:30 |
Robie Basak |
tags |
patch quantal verification-needed |
patch quantal verification-done |
|
2012-11-27 07:36:25 |
Scott Kitterman |
removed subscriber Ubuntu Stable Release Updates Team |
|
|
|
2012-11-27 07:37:12 |
Launchpad Janitor |
php5 (Ubuntu Quantal): status |
Fix Committed |
Fix Released |
|
2014-04-22 10:48:54 |
Robie Basak |
bug watch added |
|
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=618462 |
|