From:             kulakov74 at yandex dot ru
Operating system: Linux
PHP version:      4.3.7
PHP Bug Type:     Date/time related
Bug description:  Different timezone's time is stored in Apache process for other 
requests

Description:
------------
I tried putenv('TZ=...') to get local time for any timezone. After that,
if I don't call putenv('TZ=...') using date/time functions (date()) in
consequent requests randomly return either local time or the time for the
zone last set with TZ. In Apache access_log's time offsets also vary. It
seems that Apache proccesses remember the time for the timezone set with
TZ and use it for consequent requests. 

Unfortunately, there's no function for deleting an environment variable.
Even though with consequent requests TZ seems to be undefined, date
functions work as if it were set for the last value. 

For a reason, calling mktime(0,0,0,1,1,1970) clears Apache's processes
internal time, but that happens only on subsequent requests, not within
the same one. 

Of course, one can use putenv('TZ=...') for setting local timezone back
after working with a different timezone, but anyway I guess that shouldn't
be the way it is. 

We use Apache 2. 

Reproduce code:
---------------
//first request:
echo(date('H:i:s').'<BR>'); //localtime
putenv('TZ=Europe/Moscow');
echo(date('H:i:s').'<BR>'); //Moscow time - works okay

//at consequent requests:
echo(date('H:i:s').'<BR>'); //may produce local or Moscow time, depending
on which Apache process handles the request

Expected result:
----------------
see above

Actual result:
--------------
see above

-- 
Edit bug report at http://bugs.php.net/?id=29654&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29654&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29654&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29654&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29654&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29654&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29654&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29654&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29654&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29654&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29654&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29654&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29654&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29654&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29654&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29654&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29654&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29654&r=float

Reply via email to