]> granicus.if.org Git - php/commitdiff
MFB Fix for #25825
authorWez Furlong <wez@php.net>
Wed, 15 Oct 2003 00:18:53 +0000 (00:18 +0000)
committerWez Furlong <wez@php.net>
Wed, 15 Oct 2003 00:18:53 +0000 (00:18 +0000)
ext/standard/basic_functions.c

index c8e45c71faee3b3ba25c142775d35485b0912bab..a2a11e398c94cd77888416143aeaae97968d992b 100644 (file)
@@ -1024,6 +1024,14 @@ static void php_putenv_destructor(putenv_entry *pe)
                }
 # endif
        }
+#ifdef HAVE_TZSET
+       /* 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();
+       }
+#endif
+               
        efree(pe->putenv_string);
        efree(pe->key);
 }
@@ -1423,7 +1431,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