PHP 4.0 Bug #8609: putenv failing with TZ
| From: | seth at northrops dot com | Date: | Tue, 09 Jan 2001 08:29:26 +0000 |
| Subject: | PHP 4.0 Bug #8609: putenv failing with TZ | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43514@lists.php.net to get a copy of this message | ||
From: seth@northrops.com
Operating system: Linux/FreeBSD
PHP version: 4.0.4
PHP Bug Type: Date/time related
Bug description: putenv failing with TZ
I noticed that there are still issues with switching between
timezones.
For example, given the following:
<?
# foo.php
putenv("TZ=Greenwich");
echo date("H")."\n";
putenv("TZ=US/Central");
echo date("H")."\n";
putenv("TZ=Greenwich");
echo date("H")."\n";
?>
$./php3 foo.php
Content-type: text/html
03
21
03
$./php4 foo.php
X-Powered-By: PHP/4.0.1pl2
Content-type: text/html
03
03
03
$./php4.4 foo.php
X-Powered-By: PHP/4.0.4
Content-type: text/html
03
03
03
Notice it worked in php3, but is failing within PHP 4 (including 4.0.4). Also notice that the first
switch usually works; though, I've even noticed where the first putenv fails and the script
stays within the local timezone.
I also noticed there has been previous discussion (but no response?) on the topic:
http://marc.theaimsgroup.com/?l=php-general&m=97666005518422&w=2
http://marc.theaimsgroup.com/?l=php-general&m=97157283226980&w=2
Finally, it APPEARS that calling mktime after the putenv in 4.0.x seems to cause the putenv to work.
(ie, it seems to activate the TZ change). Absent a mktime, it stays in the local timezone.
--
Edit Bug report at: http://bugs.php.net/?id=8609&edit=1