Hi !
Here is small patch which makes ext/standard/datetime.c & parsedate.y use reentrant versions of date/time functions declared in PHP (php_localtime_r & php_gmtime_r).
May somebody commit it ?
Regards, Wojtek
Index: datetime.c =================================================================== RCS file: /repository/php-src/ext/standard/datetime.c,v retrieving revision 1.96.2.15 diff -u -r1.96.2.15 datetime.c --- datetime.c 31 Mar 2004 17:59:28 -0000 1.96.2.15 +++ datetime.c 25 Jun 2004 11:15:29 -0000 @@ -222,12 +222,12 @@ */ if (is_dst == -1) { struct tm t1, t2; - t1 = *localtime(&t); - t2 = *localtime(&seconds); + php_localtime_r(&t,&t1); + php_localtime_r(&seconds,&t2); if (t1.tm_isdst != t2.tm_isdst) { seconds += (t1.tm_isdst == 1) ? 3600 : -3600; - ta = localtime(&seconds); + ta = php_localtime_r(&seconds,&tmbuf); } /* Index: parsedate.y =================================================================== RCS file: /repository/php-src/ext/standard/parsedate.y,v retrieving revision 1.34.2.7 diff -u -r1.34.2.7 parsedate.y --- parsedate.y 8 Apr 2004 19:21:46 -0000 1.34.2.7 +++ parsedate.y 25 Jun 2004 11:15:30 -0000 @@ -967,13 +967,13 @@ time_t php_parse_date(char *p, time_t *now) { - struct tm tm, tm0, *tmp; + struct tm tm, tm0, *tmp, tmbuf; time_t Start; struct date_yy date; date.yyInput = p; Start = now ? *now : time ((time_t *) NULL); - tmp = localtime (&Start); + tmp = php_localtime_r (&Start, &tmbuf); if (!tmp) return -1; date.yyYear = tmp->tm_year + TM_YEAR_ORIGIN; @@ -1072,7 +1072,8 @@ if (date.yyHaveZone) { long delta; - struct tm *gmt = gmtime (&Start); + struct tm tmbuf; + struct tm *gmt = php_gmtime_r (&Start, &tmbuf); if (!gmt) return -1; delta = date.yyTimezone * 60L + difftm (&tm, gmt);
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php