|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7203 Lack of calling tzset() in some php internal code
Submitted: 2000-10-14 04:27 UTC Modified: 2001-01-09 04:08 UTC
From: christian dot robert at polymtl dot ca Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.3 OS: Linux Slackware 7
Private report: No CVE-ID: None
 [2000-10-14 04:27 UTC] christian dot robert at polymtl dot ca
I recently found a problem on a php piece of code 
who looks like:

putenv("TZ=$Some_TZ");  // Like "EST5EDT"
$val=  strftime("%Z");
echo "Timezone = ".$val;

It sometimes get the right value, sometimes some "near" garbage
values. Not repeateable (at random under apache).

it looks like that under standard linux(glibc2), all "time" related function
should call "C" function tzset() before first usage.

I see in the source that:  _php_mktime() is calling tzset() #if HAVE_TZSET

the strftime() function need this too (for linux at least)



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-02 17:58 UTC]
The tzset documentation on Linux says this:
The  tzset() function initializes the tzname variable from
the TZ environment variable.  This function  is  automati?
cally  called  by the other time conversion functions that
depend on the time zone.

But strftime is really a libc thingy, and is not emulated in PHP.

Please also try php 4.0.4, there where some fixes in it that had to do with date and time stuff.
 [2001-01-09 04:08 UTC]
Fixed in CVS. Thank you for pointing this out.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 00:01:33 2024 UTC