Doc #60602 [Com]: $env can be destructively changed.
| From: | virtual dot greg at gmail dot com | Date: | Sat, 25 Feb 2012 20:36:53 +0000 |
| Subject: | Doc #60602 [Com]: $env can be destructively changed. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8004@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60602&edit=1
ID: 60602
Comment by: virtual dot greg at gmail dot com
Reported by: me at ktamura dot com
Summary: $env can be destructively changed.
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: OSX 10.6.8
PHP Version: 5.4SVN-2011-12-23 (SVN)
Block user comment: N
Private report: N
New Comment:
This does manifest in PHP 5.3.8 on OS X 10.6.8 as well. A question to the OP: the
documentation says to pass NULL to use the same environment as the current PHP
process.
If ['argv'] is a string it is unaffected. Only if the element is an array does
this modification occur. See my gist https://gist.github.com/1910448
Previous Comments:
------------------------------------------------------------------------
[2011-12-23 16:48:01] me at ktamura dot com
the "../futz/a.php" in the expected/actual output is the script's name.
------------------------------------------------------------------------
[2011-12-23 16:27:45] me at ktamura dot com
Description:
------------
---
From manual page: http://www.php.net/function.proc-open#refsect1-function.proc-
open-description
---
The $env argument can be destructively changed as a result of calling proc_open.
We should either document so or change the behavior of the function so that $env's
values are not changed as a result of invoking proc_open.
Test script:
---------------
<?php
print_r($_SERVER['argv']);
$pipes = array();
proc_open('/bin/echo', array(), $pipes, null, $_SERVER);
print_r($_SERVER['argv']);
Expected result:
----------------
Array
(
[0] => ../futz/a.php
)
Array
(
[0] => ../futz/a.php
)
Actual result:
--------------
Array
(
[0] => ../futz/a.php
)
Array
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60602&edit=1