diff options
| author | Wez Furlong <wez@php.net> | 2003-10-15 00:14:37 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2003-10-15 00:14:37 +0000 |
| commit | 69cfb62619ee3a5f2f58e41a9f14016876c6934d (patch) | |
| tree | 0ad937fa9b2f1540df95c3b069161ee899662b32 /ext | |
| parent | adfb56c304705c60ba746e47c11a146f86065294 (diff) | |
| download | php-git-69cfb62619ee3a5f2f58e41a9f14016876c6934d.tar.gz | |
Fix bug #25825. tzset() was not called when resetting the TZ env var.
In addition, fix a slight error (made by sniper!) which would trigger
tzset() to be called for any env var beginning with TZ, and not just
TZ itself.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/standard/basic_functions.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 7f56d7b277..04140dc74a 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -950,6 +950,12 @@ static void php_putenv_destructor(putenv_entry *pe) } # endif } + /* don't forget to reset the various libc globals that + * we might have changed by an earlier call to tzset(). */ + if (!strncmp(pe->key, "TZ", pe->key_len)) { + tzset(); + } + efree(pe->putenv_string); efree(pe->key); } @@ -1347,7 +1353,7 @@ PHP_FUNCTION(putenv) if (putenv(pe.putenv_string) == 0) { /* success */ zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len+1, (void **) &pe, sizeof(putenv_entry), NULL); #ifdef HAVE_TZSET - if (!strncmp(pe.key, "TZ", 2)) { + if (!strncmp(pe.key, "TZ", pe.key_len)) { tzset(); } #endif |
