php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
18 + 14 = ?
Subscribe to this entry?

 
 [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)

thanks,
Xtian.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-02 17:58 UTC] derick@php.net
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] sniper@php.net
Fixed in CVS. Thank you for pointing this out.

--Jani
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Sep 23 12:01:25 2018 UTC