ID: 42040 Updated by: [EMAIL PROTECTED] Reported By: lkc at pobox dot sk Status: Analyzed Bug Type: cURL related Operating System: Windows PHP Version: 5.2.3 New Comment:
It's affecting it because the TZ env var takes priority over the date.timezone ini setting as can be read here: http://no.php.net/manual/en/function.date-default-timezone-get.php I'd say this is a curl bug, it should unset the env var when it's done with it. Previous Comments: ------------------------------------------------------------------------ [2007-07-22 17:07:13] [EMAIL PROTECTED] I can reproduce this under Windows XP. (It appears to be a Windows-only bug.) Further info: The only way to reproduce this is if the timezone is set via the date.timezone setting in php.ini. The bug does NOT occur when the TZ env var is set via put_env(), nor when date_default_timezone_set() is called from the script. The workaround is to do either of those things before calling curl_setopt(CURLOPT_COOKIEJAR);. Somehow DATEG(timezone) is being unset and the TZ env var populated with 'GMT', regardless of the timezone on the client. The TZ env var is populated during libcurl configuration (tzset() is called after putenv('TZ=whatever')). That's the only place in the entire libcurl source it's used, given that the libcurl shipped with PHP doesn't have IDNA support. Neither tzset() nor putenv() is called in ext/curl. At runtime, the TZ env var is only populated when CURLOPT_COOKIEJAR is set (not for CURLOPT_COOKIESESSION). I've no idea why, much less why setting TZ should interfere with PHP's global datetime values. ------------------------------------------------------------------------ [2007-07-19 04:26:50] lkc at pobox dot sk Description: ------------ Using cURL with COOKIEJAR option resets timezone setting to GMT. This only occurs if: 1. The default timezone is set using date.timezone in php.ini, NOT through date_default_timezone_set(). 2. The cookie file contains timestamp(s). Reproduce code: --------------- echo date_default_timezone_get(), "\n"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_URL, "http://www.google.com"); $f = curl_exec($ch); curl_close($ch); echo date_default_timezone_get(), "\n"; Expected result: ---------------- Show identical timezones. Actual result: -------------- Second timezone is always GMT. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42040&edit=1