]> granicus.if.org Git - php/commitdiff
The fix for the vc7 libc putenv bug is also needed here to avoid a crash.
authorWez Furlong <wez@php.net>
Thu, 22 Apr 2004 14:26:03 +0000 (14:26 +0000)
committerWez Furlong <wez@php.net>
Thu, 22 Apr 2004 14:26:03 +0000 (14:26 +0000)
ext/standard/basic_functions.c

index 18d799fdd37dd0f8c56829cb21c3356035cb9066..3106022f3df13b8a302e0fc18b5a314dc50f31c1 100644 (file)
@@ -886,6 +886,13 @@ zend_module_entry basic_functions_module = {
 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