Re: PHP 4.0 Bug #7203 Updated: Lack of calling tzset() in some php internal code

From: Date: Wed, 03 Jan 2001 05:01:43 +0000
Subject: Re: PHP 4.0 Bug #7203 Updated: Lack of calling tzset() in some php internal code
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-42777@lists.php.net to get a copy of this message
well, I means in php_strftime() here a piece of code from ext/standard/datetime.c ---------------------------------------------------------- #if HAVE_STRFTIME void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) { pval **format_arg, **timestamp_arg; char *format,*buf; time_t timestamp; struct tm *ta, tmbuf; int max_reallocs = 5; size_t buf_len=64, real_len; tzset(); /* Bug fix, Xtian */ switch (ZEND_NUM_ARGS()) { case 1: ----------------------------------------------------------- the tzset() call is what I added to the code in php 4.0.3 to fix the bug. It should probably be surrounded by #ifdef HAVE_TZSET tzset(); #endif thanks, Xtian. Bug Database wrote: > > ID: 7203 > Updated by: derick > Reported By: christian.robert@polymtl.ca > Old-Status: Open > Status: Assigned > Bug Type: Date/time related > Assigned To: derick > Comments: > > 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. > > Previous Comments: > --------------------------------------------------------------------------- > > [2000-10-14 04:27:04] christian.robert@polymtl.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. > > --------------------------------------------------------------------------- > > Full Bug description available at: http://bugs.php.net/?id=7203

« previous php.dev (#42777) next »