]> granicus.if.org Git - php/commitdiff
Fix bug #25825. tzset() was not called when resetting the TZ env var.
authorWez Furlong <wez@php.net>
Wed, 15 Oct 2003 00:14:37 +0000 (00:14 +0000)
committerWez Furlong <wez@php.net>
Wed, 15 Oct 2003 00:14:37 +0000 (00:14 +0000)
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.

NEWS
ext/standard/basic_functions.c

diff --git a/NEWS b/NEWS
index 6093cd5bab6cd615e4b22218178627ddea1606fd..b7517c550e6de0f36d4cae0d16dd46df7610bca0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Oct 2003, Version 4.3.4RC2
+- Fixed bug #25825 (tzset() was not called to reset libc environment
+  on request shutdown). (Wez)
 - Fixed multibyte regex engine to properly handle ".*" pattern under
   POSIX compatible mode. (K.Kosako <kosako at sofnec.co.jp>, Moriyoshi)
 - Fixed bug #25836 (last key of multi-dimensional array passed via GPC not
index 7f56d7b277574442c91019e3b4e72d3fa75f7f6f..04140dc74a150ea56590136eee0efb0a00f6f8b9 100644 (file)
@@ -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