]> granicus.if.org Git - php/commitdiff
fix putenv - if there was no previous, remove variable from environ
authorStanislav Malyshev <stas@php.net>
Wed, 21 Feb 2007 03:03:37 +0000 (03:03 +0000)
committerStanislav Malyshev <stas@php.net>
Wed, 21 Feb 2007 03:03:37 +0000 (03:03 +0000)
ext/standard/basic_functions.c

index 0a0009d1332709529a9fb60565e39117eb8ff8e7..8d6f45005a81af12e8ca99a82908dd346f48eaa5 100644 (file)
@@ -3851,6 +3851,10 @@ static void php_putenv_destructor(putenv_entry *pe)
 # if HAVE_UNSETENV
                unsetenv(pe->key);
 # elif defined(PHP_WIN32)
+               char *del_string = emalloc(pe->key_len+2);
+               snprintf(del_string, pe->key_len+2, "%s=", pe->key);
+               putenv(del_string);
+               efree(del_string);
                SetEnvironmentVariable(pe->key, NULL);
 # else
                char **env;