php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40934 putenv("TZ=xxxx") doesn't reset correctly
Submitted: 2007-03-28 06:06 UTC Modified: 2007-04-02 12:26 UTC
From: vaughn at solarword dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.1 OS: Windows NT XANADU 5.2 build 3790
Private report: No CVE-ID: None
 [2007-03-28 06:06 UTC] vaughn at solarword dot net
Description:
------------
Using Stock PHP5.2.1 msi package downloaded from php.net (Same bug appeared in php-4.3.11)  Apache version=2.0.53

Problem: The first time that TZ is set, that value becomes the new default for future php runs.

This doesn't appear to be like bug #37908 as the apache logs timestamps are not changed.

PHP Configure line:
cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" 

Apache config:
PHPIniDir "D:/PHP5/"
LoadModule php5_module "D:\\PHP5\\php5apache2.dll"

-------------------------------
diff php-dist.ini php.ini
-------------------------------
128c128
< short_open_tag = Off
---
> short_open_tag = On
300c300
< max_execution_time = 30     ; Maximum execution time of each script, in seconds
---
> max_execution_time = 300     ; Maximum execution time of each script, in seconds
347,349c347,350
< ;   - Show all errors, except coding standards warnings
< ;
< error_reporting  =  E_ALL
---
> ;   - Show all errors
> ; 
> #error_reporting  =  E_ALL
> error_reporting  =  E_ALL & ~E_NOTICE
374c375
< ignore_repeated_errors = Off
---
> ignore_repeated_errors = On
412a414
> error_log = "d:\php5\logfile.log"
513c515
< doc_root =
---
> doc_root = "d:\SJAtlanticus"
519a522,523
> extension_dir = "d:/PHP5/ext"
> ;extension_dir = "./"
638a643
> ;extension=php_filepro.dll
721c726,727
< SMTP = localhost
---
> #SMTP = localhost
> SMTP = xanadu
725c731
< ;sendmail_from = me@example.com
---
> sendmail_from = admin@sanjuanairlines.com
1013a1020
> session.save_path = d:/php/php_sessions
1051c1058,1059
< session.gc_probability = 1
---
> session.gc_probability = 0
> ;session.gc_probability = 1
1309a1318,1325
> [PHP_GD2]
> extension=php_gd2.dll
> [PHP_MBSTRING]
> extension=php_mbstring.dll
> [PHP_ZIP]
> extension=php_zip.dll
> [PHP_SMTP]
> extension=php_smtp.dll


Reproduce code:
---------------
<?
print getenv("TZ");
print "<br>";
putenv("TZ=CST6CDT");
print getenv("TZ");
?>

Expected result:
----------------
<br>CST6CDT

Actual result:
--------------
Output (1st)
<br>CST6CDT
Output (2nd)
CST6CDT<br>CST6CDT


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-28 07:09 UTC] derick@php.net
Come comments:
- don't use the TZ env var for setting timezones
- don't use broken timezone identifiers like CST6DST
See:
- http://no.php.net/manual/en/function.date-default-timezone-set.php
- http://no.php.net/manual/en/timezones.php
 [2007-03-28 14:14 UTC] vaughn at solarword dot net
date_default_timezone() addresses it.  This will not work for php4 though which is no longer a concern for me.  Thanks.
 [2007-03-28 14:15 UTC] vaughn at solarword dot net
Make that date_default_timezone_set();
 [2007-04-02 12:26 UTC] sniper@php.net
.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 00:01:34 2025 UTC