#41904 [Opn]: proc_open with empty array as $env uses $_ENV of parent
| From: | vrana@php.net | Date: | Thu, 16 Aug 2007 12:48:29 +0000 |
| Subject: | #41904 [Opn]: proc_open with empty array as $env uses $_ENV of parent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-116211@lists.php.net to get a copy of this message | ||
ID: 41904
Updated by: vrana@php.net
Reported By: martin dot partel at mbnet dot fi
Status: Open
-Bug Type: Documentation problem
+Bug Type: Program Execution
Operating System: Linux
PHP Version: 5.2.3
New Comment:
Empty array should pass empty environment to be able to pass this
special value.
Previous Comments:
------------------------------------------------------------------------
[2007-07-05 13:51:44] tony2001@php.net
Reclassified as docu issue.
------------------------------------------------------------------------
[2007-07-05 13:35:01] martin dot partel at mbnet dot fi
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 this bug report at http://bugs.php.net/?id=41904&edit=1