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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: christian dot robert at polymtl dot ca
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 17:01:29 2024 UTC