static void php_putenv_destructor(putenv_entry *pe)
{
if (pe->previous_value) {
+#if _MSC_VER >= 1300
+ /* VS.Net has a bug in putenv() when setting a variable that
+ * is already set; if the SetEnvironmentVariable() API call
+ * fails, the Crt will double free() a string.
+ * We try to avoid this by setting our own value first */
+ SetEnvironmentVariable(pe->key, "bugbug");
+#endif
putenv(pe->previous_value);
} else {
# if HAVE_UNSETENV