|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-05 13:51 UTC] tony2001@php.net
[2007-08-16 12:48 UTC] vrana@php.net
[2007-08-17 10:43 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 09:00:01 2025 UTC |
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.