mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
MFH: fix putenv("var") (i.e. unset) on BSD systems
add test
This commit is contained in:
parent
695e81c2cc
commit
16129b7024
2 changed files with 36 additions and 1 deletions
|
@ -4461,8 +4461,15 @@ PHP_FUNCTION(putenv)
|
|||
* We try to avoid this by setting our own value first */
|
||||
SetEnvironmentVariable(pe.key, "bugbug");
|
||||
#endif
|
||||
|
||||
|
||||
#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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue