#30778 [NEW]: need unset support for putenv

From: Date: Sat, 13 Nov 2004 20:44:58 +0000
Subject: #30778 [NEW]: need unset support for putenv
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69017@lists.php.net to get a copy of this message
From: sagawa at sohgoh dot net Operating system: FreeBSD, SunOS PHP version: 4.3.9 PHP Bug Type: Feature/Change Request Bug description: need unset support for putenv Description: ------------ PHP doesn't support unsetenv, therefore I can't unset environment variable. On Linux box, putenv C function supports putenv("FOO") syntax that vanish FOO environment variable. But other OS (such as SunOS, FreeBSD) is not. Therefore please add putenv("FOO") feature to others in PHP5. Note: please distinguish empty variable (= getenv returns "") from undefined one (= getenv returns false). Reproduce code: --------------- <?php echo "OS: ",PHP_OS,"\n"; echo "foo is "; var_dump(getenv("FOO")); echo "---\n"; echo "putenv(\"FOO=bar\"): "; var_dump(putenv("FOO=bar")); echo "foo is "; var_dump(getenv("FOO")); echo "---\n"; echo "putenv(\"FOO=baz\"): "; var_dump(putenv("FOO=baz")); echo "foo is "; var_dump(getenv("FOO")); echo "---\n"; echo "putenv(\"FOO\"): "; var_dump(putenv("FOO")); echo "foo is "; var_dump(getenv("FOO")); ?> Expected result: ---------------- % php envtest.php OS: Linux foo is bool(false) --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(true) foo is bool(false) % env FOO=foo php envtest.php OS: Linux foo is string(3) "foo" --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(true) foo is bool(false) Actual result: -------------- % php envtest.php OS: FreeBSD foo is bool(false) --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(false) foo is bool(false) % env FOO=foo php envtest.php OS: FreeBSD foo is string(3) "foo" --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(false) foo is string(3) "baz" % php envtest.php OS: SunOS foo is bool(false) --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(true) foo is bool(false) % env FOO=foo php envtest.php OS: SunOS foo is string(3) "foo" --- putenv("FOO=bar"): bool(true) foo is string(3) "bar" --- putenv("FOO=baz"): bool(true) foo is string(3) "baz" --- putenv("FOO"): bool(true) foo is string(3) "foo" -- Edit bug report at http://bugs.php.net/?id=30778&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30778&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30778&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30778&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30778&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30778&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30778&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30778&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30778&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30778&r=support Expected behavior: http://bugs.php.net/fix.php?id=30778&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30778&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30778&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30778&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30778&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30778&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30778&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30778&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30778&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30778&r=mysqlcfg

« previous php.bugs (#69017) next »