|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #60602 $env can be destructively changed.
Submitted: 2011-12-23 16:27 UTC Modified: 2014-03-02 22:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: me at ktamura dot com Assigned: datibbaw (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.4SVN-2011-12-23 (SVN) OS: OSX 10.6.8
Private report: No CVE-ID: None
 [2011-12-23 16:27 UTC] me at ktamura dot com
From manual page:

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:
$pipes = array();
proc_open('/bin/echo', array(), $pipes, null, $_SERVER);

Expected result:
    [0] => ../futz/a.php

    [0] => ../futz/a.php

Actual result:
    [0] => ../futz/a.php



Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-23 16:48 UTC] me at ktamura dot com
the "../futz/a.php" in the expected/actual output is the script's name.
 [2012-02-25 20:36 UTC] virtual dot greg at gmail dot com
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 

If ['argv'] is a string it is unaffected. Only if the element is an array does 
this modification occur. See my gist
 [2013-10-10 04:13 UTC]
The behaviour is accompanied by a notice as well:

> PHP Notice:  Array to string conversion in file on line number

The notice comes from here:

Any element in $_SERVER that's not a string will get converted. This should be reflected in the documentation.
 [2014-03-02 22:56 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: datibbaw
 [2014-03-02 22:56 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Fixed in next 5.4, 5.5 or 5.6
 [2014-04-05 23:09 UTC] jimmy_libra_98 at hotmail dot com
kiero q me regale un poco de oro y u poco de comandos con unos heros para aser mas fuereete
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 10:01:31 2024 UTC