diff options
| author | Antony Dovgal <tony2001@php.net> | 2007-04-17 20:33:45 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2007-04-17 20:33:45 +0000 |
| commit | cea78baddf5f90012d4dfed2fa1e2c244fb96808 (patch) | |
| tree | ece2f5195bdfeb721c88861038ef5126a8eb6647 /ext/standard/basic_functions.c | |
| parent | 83b3d8545e8f37c7115bc36ebd8db8b15c86708c (diff) | |
| download | php-git-cea78baddf5f90012d4dfed2fa1e2c244fb96808.tar.gz | |
fix putenv("var") (i.e. unset) on BSD systems
add test
Diffstat (limited to 'ext/standard/basic_functions.c')
| -rw-r--r-- | ext/standard/basic_functions.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index efc39d03dc..833b75d738 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4443,8 +4443,15 @@ PHP_FUNCTION(putenv) * We try to avoid this by setting our own value first */ SetEnvironmentVariable(pe.key, "bugbug"); #endif - - if (putenv(pe.putenv_string) == 0) { /* success */ + +#if HAVE_UNSETENV + if (!p) { /* no '=' means we want to unset it */ + unsetenv(pe.putenv_string); + } + if (!p || putenv(pe.putenv_string) == 0) { /* success */ +#else + if (putenv(pe.putenv_string) == 0) { /* success */ +#endif 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", pe.key_len)) { |
