#35660 [Asn->Csd]: AIX TZ variable format not understood, yields UTC timezone

From: Date: Tue, 20 Dec 2005 19:54:24 +0000
Subject: #35660 [Asn->Csd]: AIX TZ variable format not understood, yields UTC timezone
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90760@lists.php.net to get a copy of this message
 ID:               35660
 Updated by:       derick@php.net
 Reported By:      Bjorn dot Wiberg at its dot uu dot se
-Status:           Assigned
+Status:           Closed
 Bug Type:         Date/time related
 Operating System: IBM AIX 5.2.0.0 ML5
 PHP Version:      5.1.1
 Assigned To:      derick
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2005-12-18 10:40:38] Bjorn dot Wiberg at its dot uu dot se

Hello Derick!

Thank you for your reply!

Yes, I know, however, performance is not a big issue for us in this
case.

It would be great if those AIX timezones could be added to the built-in
database of known timezones of PHP, or perhaps even better, if PHP would
default to the date.timezone setting if TZ is considered invalid (the
latter is probably easier to achieve and would cover *all* platforms
with "special" TZ formats).

Please e-mail me if you need us to carry out any AIX tests for you!

Wishing you a Merry Christmas and a Happy New year!

Best regards,
Björn

------------------------------------------------------------------------

[2005-12-17 18:41:02] derick@php.net

Just to let you know, using the date_default_timezone_set() function is
preferred over using the TZ env setting as it's faster.

------------------------------------------------------------------------

[2005-12-13 19:28:32] Bjorn dot Wiberg at its dot uu dot se

Description:
------------
PHP does not understand the notion of the TZ environment variable that
IBM AIX uses, and defaults to the UTC time zone if an "incorrect" TZ
value is encountered.

The format of the TZ variable, and the allowed values, can be found
here:
http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.aix.doc/files/aixfiles/environment.htm

If this could be considered for future releases, that would be a great
relief. As many (all?) other software on the system seem to use the TZ
correctly.


Otherwise, it would be great if the date.timezone setting would act as
a fallback in case the TZ environment variable is considered invalid by
PHP.

And, perhaps, that this is clarified in the documentation
(http://se.php.net/manual/sv/function.date-default-timezone-get.php);
i.e., that an incorrect TZ value directly yields a "UTC" timezone
setting.

Reproduce code:
---------------
System environment configuration file /etc/environment contains:
TZ=NFT-1DFT,M3.5.0/02:00:00,M10.5.0/03:00:00

httpd.conf contains:
php_value date.timezone "Europe/Stockholm"

PHP script that displays the reverting-to-UTC behavior of PHP:

<?php
//  putenv('TZ=NFT-1DFT,M3.5.0/02:00:00,M10.5.0/03:00:00');

  echo 'TZ is: ' . getenv('TZ') . '<BR>';
  echo 'date.timezone is: ' . ini_get('date.timezone') . '<BR>';
  echo 'date_default_timezone_get() returns: ' .
date_default_timezone_get() . '<BR>';
  echo 'Current time is: ' . strftime('%T') . '<BR>';

  echo '<BR>';

  echo 'Forcing the correct timezone (' . ini_get('date.timezone') .
')...<BR>';
  date_default_timezone_set(ini_get('date.timezone'));
  echo 'Correct current time is: ' . strftime('%T') . '<BR>';
?>


Expected result:
----------------
That the timezone is picked up and understood by PHP. This would equal
the "Europe/Stockholm" timezone setting. That is:

TZ is: NFT-1DFT,M3.5.0/02:00:00,M10.5.0/03:00:00
date.timezone is: Europe/Stockholm
date_default_timezone_get() returns: Europe/Stockholm
Current time is: 19:20:10

Forcing the correct timezone (Europe/Stockholm)...
Correct current time is: 19:20:10

Actual result:
--------------
TZ is: NFT-1DFT,M3.5.0/02:00:00,M10.5.0/03:00:00
date.timezone is: Europe/Stockholm
date_default_timezone_get() returns: UTC
Current time is: 18:20:10

Forcing the correct timezone (Europe/Stockholm)...
Correct current time is: 19:20:10


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35660&edit=1


Thread (10 messages)

« previous php.bugs (#90760) next »