#41904 [NEW]: proc_open with empty array as $env uses $_ENV of parent

From: Date: Thu, 05 Jul 2007 13:35:01 +0000
Subject: #41904 [NEW]: proc_open with empty array as $env uses $_ENV of parent
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-114666@lists.php.net to get a copy of this message
From: martin dot partel at mbnet dot fi Operating system: Linux PHP version: 5.2.3 PHP Bug Type: Program Execution Bug description: proc_open with empty array as $env uses $_ENV of parent Description: ------------ The documentation of proc_open states that passing NULL as the $env parameter of proc_open has the child process use the same environment as the current PHP process. Passing an empty array seems to have the same effect, even though intuitively it should give the child process an empty environment. Reproduce code: --------------- <?php echo '<pre>'; $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), ); $cwd = '/tmp'; $env = array(); $process = proc_open('php', $descriptorspec, $pipes, $cwd, $env); if (is_resource($process)) { fwrite($pipes[0], '<?php print_r($_ENV); ?>'); fclose($pipes[0]); echo stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); } Expected result: ---------------- The script should output an (almost) empty $_ENV. Actual result: -------------- The script outputs the $_ENV of the parent process. -- Edit bug report at http://bugs.php.net/?id=41904&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41904&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41904&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41904&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41904&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41904&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41904&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41904&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41904&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41904&r=support Expected behavior: http://bugs.php.net/fix.php?id=41904&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41904&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41904&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41904&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41904&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41904&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41904&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41904&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41904&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41904&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41904&r=mysqlcfg

« previous php.bugs (#114666) next »